Created
June 2, 2020 08:03
-
-
Save nixcraft/66f3773d1f68f178b5b3ca8c4258cbe9 to your computer and use it in GitHub Desktop.
Ansible reboot all servers except two database servers
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: Check if a reboot is needed on all Ubuntu/Debian based servers | |
register: reboot_required_file | |
stat: path=/var/run/reboot-required get_md5=no | |
- name: Reboot the box if kernel updated | |
reboot: | |
msg: "Reboot initiated by Ansible for kernel updates" | |
connect_timeout: 5 | |
reboot_timeout: 300 | |
pre_reboot_delay: 0 | |
post_reboot_delay: 30 | |
test_command: uptime | |
when: reboot_required_file.stat.exists and ( inventory_hostname != "aws-db1" and inventory_hostname != "aws-db2" ) |
yes, much better to read. Thanks, mate!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Better: