23 lines
541 B
YAML
23 lines
541 B
YAML
|
---
|
||
|
- name: Update and upgrade apt packages
|
||
|
become: true
|
||
|
apt:
|
||
|
upgrade: yes
|
||
|
update_cache: yes
|
||
|
cache_valid_time: 86400
|
||
|
|
||
|
- name: Check to see if reboot is needed
|
||
|
register: reboot_required_file
|
||
|
stat: path=/var/run/reboot-required get_checksum=false
|
||
|
|
||
|
- name: Reboot the server
|
||
|
become: true
|
||
|
reboot:
|
||
|
msg: "Reboot initiated by Ansible due to 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
|