Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows ansible_memtotal_mb reports 1mb less #49608

Closed
gstorme opened this issue Dec 6, 2018 · 3 comments · Fixed by #49611
Closed

windows ansible_memtotal_mb reports 1mb less #49608

gstorme opened this issue Dec 6, 2018 · 3 comments · Fixed by #49611
Assignees
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community

Comments

@gstorme
Copy link
Contributor

gstorme commented Dec 6, 2018

SUMMARY

The Powershell command behind the ansible_memtotal_mb uses a math round of the TotalPhysicalMemory, but it's always rounding the value down.
Because of this, a server with 2GB for example reports 2047MB memotal_mb.

I'll create a PR to replace the math round with ceiling, so the reported MB matches the actual installed RAM in GB.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

./lib/ansible/modules/windows/setup.ps1

ANSIBLE VERSION
ansible 2.7.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]
OS / ENVIRONMENT

Tested on Windows Server 2012R2 and Windows Server 2016

STEPS TO REPRODUCE
---
- hosts:
  - test004
  tasks:
  - debug:
      msg: "{{ ansible_memtotal_mb }}"
EXPECTED RESULTS

For a server with 1GB RAM, 1024 MB
For a server with 2GB RAM, 2048 MB
...

ACTUAL RESULTS

1GB -> 1023MB
2GB -> 2047MB
...

@ansibot
Copy link
Contributor

ansibot commented Dec 6, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Dec 6, 2018

@gstorme: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • ansible version

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Dec 6, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community labels Dec 6, 2018
@ansibot ansibot removed needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. labels Dec 6, 2018
@samdoran samdoran added has_pr This issue has an associated PR. and removed needs_triage Needs a first human triage before being processed. labels Dec 11, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants