blob: 537ccb372e2ad298cc82f0621be25aa782abafee [file] [log] [blame]
Zack Williamsa9421e22016-03-02 13:53:37 -07001---
2# file: roles/common-prep/handlers/main.yml
3
4# from https://support.ansible.com/hc/en-us/articles/201958037-Reboot-a-server-and-wait-for-it-to-come-back
Zack Williams709f11b2016-03-17 14:29:51 -07005- name: restart host
Zack Williamsa9421e22016-03-02 13:53:37 -07006 shell: sleep 2 && shutdown -r now "Ansible updates triggered"
7 async: 1
8 poll: 0
9 ignore_errors: true
10
Zack Williams709f11b2016-03-17 14:29:51 -070011# wait 1m, then try to contact machine for 10m
12- name: wait for host
Zack Williamsa9421e22016-03-02 13:53:37 -070013 become: false
14 local_action:
15 wait_for host={{ inventory_hostname }}
16 port=22
Zack Williams709f11b2016-03-17 14:29:51 -070017 delay=60 timeout=600
Zack Williamsa9421e22016-03-02 13:53:37 -070018 state=started
19