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