diff --git a/playbooks/host-reboot.yml b/playbooks/host-reboot.yml index cf6c9e2da8..75bb67930f 100644 --- a/playbooks/host-reboot.yml +++ b/playbooks/host-reboot.yml @@ -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'