Anyone know why the changed_when is not reflected in the output initially?
Only in the summary?
Here's the code:
- name: disk space check
debug:
msg: "{{ item.mount }} failed check for {{ item.block_available *
4/1024000 }} free GB (Needed {{ pre_check_filesystems[item.mount] }})"
when: item.mount in pre_check_filesystems
changed_when: item.block_available * 4/1024000|float <
pre_check_filesystems[item.mount]|float
with_items:
- "{{ ansible_mounts }}
And the output (abbreviated for readabvlity):
PLAY [all]
*******************************************************************************************************
TASK [Gathering Facts]
*******************************************************************************************
ok: [mhg-desk-l09]
TASK [spacewalk/pre-check : disk space check - WARNINGS ON THIS ARE
UNRELIABLE!!!!] ******************************
*ok:* [mhg-desk-l09] => (item={'block_used': 869141, 'uuid':
'1e7b178b-2bf2-4940-a912-8974e5fc07d6', 'size_total': 10475274240,
'block_total': 2557440, 'mount': '/var', 'block_available': 1688299,
'size_available': 6915272704, 'fstype': 'xfs', 'inode_total': 5120000,
'options': 'rw,relatime,attr2,inode64,noquota', 'device': '/dev/sda5',
'inode_used': 15912, 'block_size': 4096, 'inode_available': 5104088}) => {
"msg": "*/var failed check for 6.59491796875 free GB (Needed 2)*"
}
ok: [mhg-desk-l09] => (item={'block_used': 2227072, 'uuid':
'17a5e1ee-6285-450a-b9f0-d923fda6ecb4', 'size_total': 10475274240,
'block_total': 2557440, 'mount': '/usr', 'block_available': 330368,
'size_available': 1353187328, 'fstype': 'xfs', 'inode_total': 2948608,
'options': 'rw,relatime,attr2,inode64,noquota', 'device': '/dev/sda3',
'inode_used': 305619, 'block_size': 4096, 'inode_available': 2642989}) => {
"msg": "/usr failed check for 1.2905 free GB (Needed 2)"
}
PLAY RECAP
*******************************************************************************************************
mhg-desk-l09 : *ok=2 changed=1* unreachable=0 failed=0
skipped=0 rescued=0 ignored=0
So one of those checks should trigger a "changed" - and it does in the
summary, but not in the body of the output. Another thing I just noticed .
. . there were 2 tasks, one was ok, the other was changed, but ok=2 in the
summary
Any thoughts would be appreciated
Thanks a lot,
Guy
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CABnTgtWt6pkwBxVJW5-Z4Wuy-eVnx6eWpQSVj6vUFHvHWR%3DPVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.