blob: 9161ccd48036a2161b4b38a0928d18e1be23201d [file] [log] [blame]
Zack Williamsa9421e22016-03-02 13:53:37 -07001---
Zack Williams5223dd92017-02-28 23:38:02 -07002# file: common-prep/handlers/main.yml
Zack Williamsa9421e22016-03-02 13:53:37 -07003
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 Williams5223dd92017-02-28 23:38:02 -07006 shell: >
7 sleep 2 && shutdown -r now "Ansible updates triggered"
Zack Williamsa9421e22016-03-02 13:53:37 -07008 async: 1
9 poll: 0
10 ignore_errors: true
11
Zack Williams709f11b2016-03-17 14:29:51 -070012# wait 1m, then try to contact machine for 10m
13- name: wait for host
Zack Williamsa9421e22016-03-02 13:53:37 -070014 become: false
15 local_action:
Zack Williams5223dd92017-02-28 23:38:02 -070016 wait_for
17 host={{ inventory_hostname }}
Zack Williamsa9421e22016-03-02 13:53:37 -070018 port=22
Zack Williams5223dd92017-02-28 23:38:02 -070019 search_regex=OpenSSH
20 delay=60
21 timeout=600
Zack Williamsa9421e22016-03-02 13:53:37 -070022