Odd results from query of /proc/meminfo?
When I do the following from shell...
# cat /proc/meminfo | grep MemTotal
MemTotal: 8087276 kB
But when I do the same via Ansible...
ok: [192.168.1.212] => {
"msg": "Pi Memory Total: MemTotal: 957160 kB"
}
Ansible Source...
- name: Memory Total
#shell: "cat /proc/meminfo | grep MemTotal | cut -d ':' -f2 | cut -d 'k' -f1 | tr -d ' '"
shell: "cat /proc/meminfo | grep MemTotal"
register: m
changed_when: False
\- name: Memory Total
debug:
msg: "Memory Total: \{\{ m\.stdout \}\}"
Returned value is greater than physical memory size!
racke
(Stefan Hornburg)
2
Odd results from query of /proc/meminfo?
When I do the following from shell...
# cat /proc/meminfo | grep MemTotal
MemTotal: 8087276 kB
But when I do the same via Ansible...
ok: [192.168.1.212] => {
"msg": "Pi Memory Total: MemTotal: 957160 kB"
}
Why messing with the shell when the information is already present in the facts?
- name: Show memory
debug:
msg: "{{ ansible_memory_mb }}"
TASK [Show memory] *************************************************************
ok: [bullseye-test-box] =>
msg:
nocache:
free: 828
used: 1154
real:
free: 82
total: 1982
used: 1900
swap:
cached: 0
free: 0
total: 0
used: 0
Regards
Racke