the when: doesn't really default to true. Instead when: just needs to 'see' a true or a false. It doesn't care if that is from finding a value of true or false by looking up what is stored in a variable or by running something that returns a true or false.
adding the '== true' makes the when: test that reboot_required is set to true. Without it, the when: just sees the contents of the reboot_required variable (which happens to be either true or false). Hope that helps Jon On Thursday, October 1, 2015 at 3:14:21 PM UTC+1, Dimitri Yioulos wrote: > > Thank you so much for the explanation. I understand it, but am curious as > to why "reboot required", without == true or == false, will reboot the > server if true is, in fact, returned, and not reboot if false is returned. > Does "when" default to true if no argument is explicitly provided? > > > On Wednesday, September 30, 2015 at 9:38:33 AM UTC-4, Dimitri Yioulos > wrote: >> >> Hello, all. >> >> With help from the list, I have windows updates working via the rewritten >> win_updates module found here >> <https://github.com/ansible/ansible-modules-extras/pull/854>. I'm now >> looking for a way to creat a reboot hint based on the return output. >> Here's what that output partially looks like when I run the module (using >> -v): >> >> changed: [sawintest02] => {"changed": true, "failed_update_count": 0, >> "found_update_count": 23, "installed_update_count": 23, "reboot_required": >> true, "updates": {"04f04253-f803-43b8-8b37-6841c614dd9f": {"id": >> "04f04253-f803-43b8-8b37-6841c614dd9f", "installed": true, "kb": >> ["3084135"], "title": "Security Update for Windows Server 2012 R2 >> (KB3084135)"}, ~ >> >> How would I parse this output to create a hint so that a reboot will be >> done if "reboot_required": true, and nothing be done if "reboot_required": >> false, >> >> I'm a terrible programmer, so your help is greatly appreciated. >> >> Dimitri >> > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/367104bc-0efd-457f-b937-3f1004b460be%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.