Skip to content

Instantly share code, notes, and snippets.

@kgriffs
Created July 23, 2019 19:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgriffs/1fa26e96bff4c78d66d74c4813beeedd to your computer and use it in GitHub Desktop.
Save kgriffs/1fa26e96bff4c78d66d74c4813beeedd to your computer and use it in GitHub Desktop.
Ansible - Restart Server and Wait
- name: Restart server to ensure configuration changes take hold
shell: 'sleep 2 && shutdown -r now "Reboot triggered by Ansible" && sleep 5'
async: 1
poll: 0
become: true
- name: Wait for the server to restart
local_action:
module: wait_for
host={{ inventory_hostname }}
port=22
delay=10
become: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment