Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alvaroaleman/1ae83dd82de1ee6681dc5e3e970dd625 to your computer and use it in GitHub Desktop.
Save alvaroaleman/1ae83dd82de1ee6681dc5e3e970dd625 to your computer and use it in GitHub Desktop.
---
- name: Reboot
tags: reboot
become: true
async: 1
poll: 0
shell: sleep 5 && /sbin/shutdown -r now
- name: Wait for ssh to come back
tags: reboot
local_action: wait_for
args:
delay: '25'
port: '22'
host: "{{ hostvars[inventory_hostname]['ansible_host'] }}"
search_regex: OpenSSH
timeout: "{{ reboot_timeout }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment