Created
January 28, 2016 13:56
-
-
Save jenitehan/44009656f803501ea2da to your computer and use it in GitHub Desktop.
Reboot server if required and wait for it to come back.
This file contains hidden or 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: Reboot system if required | |
command: shutdown -r now 'Rebooting to complete system upgrade' removes=/var/run/reboot-required | |
register: reboot_required | |
tags: | |
- apt | |
- updates | |
- name: Wait for server to come back. | |
local_action: wait_for port={{ ansible_ssh_port }} host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10 | |
when: reboot_required.changed | |
sudo: false | |
tags: | |
- apt | |
- updates |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment