forked from compmodels/jupyterhub-deploy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
reboot.yml
21 lines (17 loc) · 821 Bytes
/
reboot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
- hosts: all
tasks:
- name: test connection (before reboot)
ping:
- name: reboot!
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
async: 1
poll: 0
become: yes
ignore_errors: true
- name: wait for SSH port down
local_action: wait_for host={% if 'ansible_ssh_host' in hostvars[inventory_hostname] %}{{ hostvars[inventory_hostname]['ansible_ssh_host'] }}{% else %}{{ inventory_hostname }}{% endif %} port=22 state=stopped
- name: wait for SSH port up
wait_for: host={% if 'ansible_ssh_host' in hostvars[inventory_hostname] %}{{ hostvars[inventory_hostname]['ansible_ssh_host'] }}{% else %}{{ inventory_hostname }}{% endif %} port=22 state=started delay=30
delegate_to: 127.0.0.1
- name: test connection (after reboot)
ping: