no, you are conflating several things there
when: hostvars[myhost]['reboot_hint']['reboot_required'] ^ that will execute when reboot_required is true. On Sat, Feb 20, 2016 at 2:16 PM, Dimitri Yioulos <[email protected]> wrote: > Thanks, Brian. OK, I'd like to use that in a "when" with the register > variable "reboot_hint.reboot_required == true". Will the following work?: > > when: hostvars[myhost][reboot_hint.reboot_required == true] > > > On Wednesday, February 17, 2016 at 12:07:40 PM UTC-5, Dimitri Yioulos > wrote: > >> I have the following play in a playbook: >> >> - hosts: talk >> gather_facts: false >> >> tasks: >> - name: win update >> win_updates: >> category: >> ['SecurityUpdates','CriticalUpdates','Updates','Tools','DefinitionUpdates','UpdateRollups'] >> register: reboot_hint >> >> I'd like to re-use reboot_hint in additional plays in the playbook via >> "when", but the playbook ultimately fails after the first "when", as in: >> >> - hosts: talk >> gather_facts: false >> >> tasks: >> - name: start Lyris services >> win_service: name={{ item }} state=started start_mode=auto >> with_items: ["ListManager", "LyrisAlert"] >> when: (lyris_hint.rc == 0) and (reboot_hint.reboot_required == >> true) # ie, the ListManager service is installed and reboot is required >> >> - hosts: admin2 >> gather_facts: false >> sudo: yes >> >> tasks: >> - nagios: action=downtime minutes=10 author="Dimitri Yioulos" >> service=host host={{item}} >> with_items: >> - talk >> when: reboot_hint.reboot_required == true >> delegate_to: admin2 >> - nagios: action=downtime minutes=20 author="Dimitri Yioulos" >> service=all host={{item}} >> with_items: >> - talk >> when: reboot_hint.reboot_required == true >> delegate_to: admin2 >> tags: >> - nagios_downtime >> >> - hosts: talk >> gather_facts: false >> >> tasks: >> - name: reboot server >> raw: 'cmd /c shutdown /r /t 0' >> when: reboot_hint.reboot_required == true >> >> This is another of my Ansible 101 questions; help making it work is >> appreciated! >> > -- > 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/fc15be47-0e5a-4b61-834c-26084736e1dd%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/fc15be47-0e5a-4b61-834c-26084736e1dd%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- ---------- Brian Coca -- 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/CACVha7fb2Omf48zLY812BocweBQ7MmFaoLDDptCFvMVXPUD6CQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
