Added reboot if required by updates
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
f1925fbc5b
commit
6847b8f14a
1 changed files with 18 additions and 0 deletions
|
@ -2,6 +2,10 @@
|
|||
- name: 'Install updates through package management'
|
||||
hosts: 'all'
|
||||
|
||||
handlers:
|
||||
- name: 'Reboot machine'
|
||||
ansible.builtin.reboot:
|
||||
|
||||
pre_tasks:
|
||||
- name: 'Update package cache if needed'
|
||||
become: true
|
||||
|
@ -20,3 +24,17 @@
|
|||
ansible.builtin.apt:
|
||||
autoclean: true
|
||||
autoremove: true
|
||||
|
||||
- name: 'Check if reboot is required'
|
||||
ansible.builtin.stat:
|
||||
path: '/var/run/reboot-required'
|
||||
register: 'reboot_required_file'
|
||||
|
||||
- name: 'Reboot machine'
|
||||
when: 'reboot_required_file.stat.exists'
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- true
|
||||
quiet: true
|
||||
changed_when: true
|
||||
notify: 'Reboot machine'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue