fix the only_if check

This commit is contained in:
Seth Vidal 2012-12-12 04:39:28 +00:00
parent aef0304fff
commit 3badbe4f91

View file

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