Last active
March 9, 2020 19:57
-
-
Save divi255/1ea5254b676c83063c0cbcc40f59bc32 to your computer and use it in GitHub Desktop.
ansible playbook for debian/ubuntu updates
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 | |
remote_user: root | |
tasks: | |
- name: update everything | |
apt: upgrade=dist force_apt_get=yes autoclean=yes | |
- name: check if a reboot is necessary | |
register: reboot_required_file | |
stat: path=/var/run/reboot-required get_md5=no | |
- name: reboot | |
reboot: | |
msg: "reboot initiated by ansible due to kernel updates" | |
connect_timeout: 5 | |
reboot_timeout: 30 | |
pre_reboot_delay: 0 | |
post_reboot_delay: 30 | |
test_command: uptime | |
when: reboot_required_file.stat.exists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment