Last active
July 23, 2018 22:32
-
-
Save guoqiao/dcc902e92ce73167600f6764d34b3a0a to your computer and use it in GitHub Desktop.
ansible tasks to reboot server and wait it 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
- name: restart server if ulimit changed | |
become: yes | |
shell: sleep 2 && reboot | |
async: 1 | |
poll: 0 | |
ignore_errors: yes | |
- name: wait for server to come back | |
local_action: | |
module: wait_for | |
host: "{{ansible_host}}" | |
port: 22 # have to provide and harcode it | |
delay: 30 | |
timeout: 120 | |
sleep: 2 | |
state: started | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment