try w/a needs-reboot check first

This commit is contained in:
Seth Vidal 2012-12-12 04:36:27 +00:00
parent 0794d1422a
commit aef0304fff

View file

@ -5,12 +5,19 @@
user: root
tasks:
- name: see if it needs to be rebooted
action: shell test -f /usr/local/bin/needs-reboot.py && /usr/local/bin/needs-reboot.py
ignore_errors: True
register: needsreboot
- name: reboot the host
action: command /sbin/reboot
action: command touch /tmp/would-reboot
#/sbin/reboot
only_if: '${needsreboot.stdout}.find("yes") != -1'
- name: wait for host to come back - up to 6 minutes
local_action: wait_for host=${inventory_hostname} port=22 delay=10 timeout=420
only_if: '${needsreboot.stdout}.find("yes") != -1'