Created
July 23, 2019 19:53
-
-
Save kgriffs/1fa26e96bff4c78d66d74c4813beeedd to your computer and use it in GitHub Desktop.
Ansible - Restart Server and Wait
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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