Skip to content

Instantly share code, notes, and snippets.

@guoqiao
Last active July 23, 2018 22:32
Show Gist options
  • Save guoqiao/dcc902e92ce73167600f6764d34b3a0a to your computer and use it in GitHub Desktop.
Save guoqiao/dcc902e92ce73167600f6764d34b3a0a to your computer and use it in GitHub Desktop.
ansible tasks to reboot server and wait it come back
- 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