[stable-2.7] fix memtotal_mb rounding on VMWare and swaptotal_mb conversion from KB to MB (#50055)
* fix facts memtotal_mb rounding on VMWare and swaptotal_mb conversion from KB to MB
(cherry picked from commit cc3e43cb20
)
* add changelog fragment
This commit is contained in:
parent
aa10266d55
commit
44087c7554
2 changed files with 4 additions and 2 deletions
2
changelogs/fragments/windows_setup_memtotal.yml
Normal file
2
changelogs/fragments/windows_setup_memtotal.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- setup - fix the rounding of the ansible_memtotal_mb value on VMWare vm's (https://github.com/ansible/ansible/issues/49608)
|
|
@ -298,8 +298,8 @@ if($gather_subset.Contains('memory')) {
|
|||
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
|
||||
$ansible_facts += @{
|
||||
# Win32_PhysicalMemory is empty on some virtual platforms
|
||||
ansible_memtotal_mb = ([math]::round($win32_cs.TotalPhysicalMemory / 1024 / 1024))
|
||||
ansible_swaptotal_mb = ([math]::round($win32_os.TotalSwapSpaceSize / 1024 / 1024))
|
||||
ansible_memtotal_mb = ([math]::ceiling($win32_cs.TotalPhysicalMemory / 1024 / 1024))
|
||||
ansible_swaptotal_mb = ([math]::round($win32_os.TotalSwapSpaceSize / 1024))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue