Created
June 26, 2018 08:10
-
-
Save rsevilla87/6a206f296e171b429cb8d021ff6c810d to your computer and use it in GitHub Desktop.
Reboot system with Ansible and wait of it to come back
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
- hosts: all | |
become: yes | |
gather_facts: no | |
remote_user: cloud-user | |
tasks: | |
- name: "Reboot system" | |
shell: sleep 5 && /usr/sbin/reboot | |
async: 1 | |
poll: 0 | |
- name: "Wait for server to finish reboot" | |
wait_for_connection: | |
timeout: 120 | |
delay: 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With the reboot module available since Ansible 2.7 things become easier :-)
Ad an ad-hoc command
or in a playbook