mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #8227 from trondhindenes/win_setup_improvements
win_setup improvements: Correcly outputs ansible_totalmem
This commit is contained in:
commit
6c42cd09f9
1 changed files with 5 additions and 2 deletions
|
@ -26,7 +26,10 @@ $result = New-Object psobject @{
|
||||||
};
|
};
|
||||||
|
|
||||||
$osversion = [Environment]::OSVersion
|
$osversion = [Environment]::OSVersion
|
||||||
$memory = Get-WmiObject win32_Physicalmemory
|
$memory = @()
|
||||||
|
$memory += Get-WmiObject win32_Physicalmemory
|
||||||
|
$capacity = 0
|
||||||
|
$memory | foreach {$capacity += $_.Capacity}
|
||||||
$netcfg = Get-WmiObject win32_NetworkAdapterConfiguration
|
$netcfg = Get-WmiObject win32_NetworkAdapterConfiguration
|
||||||
|
|
||||||
Set-Attr $result.ansible_facts "ansible_hostname" $env:COMPUTERNAME;
|
Set-Attr $result.ansible_facts "ansible_hostname" $env:COMPUTERNAME;
|
||||||
|
@ -36,7 +39,7 @@ Set-Attr $result.ansible_facts "ansible_os_family" "Windows"
|
||||||
Set-Attr $result.ansible_facts "ansible_distribution" $osversion.VersionString
|
Set-Attr $result.ansible_facts "ansible_distribution" $osversion.VersionString
|
||||||
Set-Attr $result.ansible_facts "ansible_distribution_version" $osversion.Version.ToString()
|
Set-Attr $result.ansible_facts "ansible_distribution_version" $osversion.Version.ToString()
|
||||||
|
|
||||||
Set-Attr $result.ansible_facts "ansible_totalmem" $memory.Capacity.ToString()
|
Set-Attr $result.ansible_facts "ansible_totalmem" $capacity
|
||||||
|
|
||||||
$ips = @()
|
$ips = @()
|
||||||
Foreach ($ip in $netcfg.IPAddress) { If ($ip) { $ips += $ip } }
|
Foreach ($ip in $netcfg.IPAddress) { If ($ip) { $ips += $ip } }
|
||||||
|
|
Loading…
Reference in a new issue