Add apt upgrade w/ reboot
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
20
roles/common/tasks/main.yml
Normal file
20
roles/common/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
- name: Upgrade all packages
|
||||
ansible.builtin.apt:
|
||||
name: "*"
|
||||
state: latest
|
||||
update_cache: yes
|
||||
|
||||
- name: Check if a reboot is needed
|
||||
ansible.builtin.stat:
|
||||
path: /var/run/reboot-required
|
||||
get_checksum: no
|
||||
register: rebootrequired
|
||||
|
||||
- name: Trigger reboot
|
||||
ansible.builtin.reboot:
|
||||
msg: "Reboot initiated by Ansible due to kernel updates"
|
||||
reboot_timeout: 300
|
||||
pre_reboot_delay: 0
|
||||
post_reboot_delay: 30
|
||||
test_command: uptime
|
||||
when: rebootrequired.stat.exists
|
Reference in New Issue
Block a user