This appears to be a bug in the default callback plugin, and only with `debug`. If you use some other task like `ping`, it would show it.
The callback plugin "cleans" the result using `self._clean_results` in `v2_runner_item_on_ok` which strips `changed` from `debug` tasks, as such the callback no longer has knowledge of whether the iteration resulted in a change. I'd recommend filing an issue on github. On Sat, Jun 15, 2019 at 12:07 PM Guy Matz <[email protected]> wrote: > oops! > > ansible --version > ansible 2.8.0 > config file = /Users/matz/Code/schransible/ansible.cfg > configured module search path = ['/Users/matz/.ansible/plugins/modules', > '/usr/share/ansible/plugins/modules'] > ansible python module location = > /Users/matz/Code/schransible/venv/lib/python3.7/site-packages/ansible > executable location = /Users/matz/Code/schransible/venv/bin/ansible > python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 > (clang-1001.0.46.3)] > > On Fri, Jun 14, 2019 at 4:02 PM Guy Matz <[email protected]> wrote: > >> 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/CABnTgtXzmtJMmwW5hcybbQphQxeY3dbxpz2uDTcHk0fw3TApVg%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CABnTgtXzmtJMmwW5hcybbQphQxeY3dbxpz2uDTcHk0fw3TApVg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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/CAD8N0v-45U9AV8LL_SoJzvjvzJTJGpwYOsfv5s2YfSd%3DRngTiA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
