Added reboot if required by updates
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Signed-off-by: Nis Wechselberg <enbewe@enbewe.de>
This commit is contained in:
parent
f1925fbc5b
commit
bc2be26833
1 changed files with 18 additions and 0 deletions
|
@ -2,6 +2,10 @@
|
||||||
- name: 'Install updates through package management'
|
- name: 'Install updates through package management'
|
||||||
hosts: 'all'
|
hosts: 'all'
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: 'Reboot machine'
|
||||||
|
ansible.builtin.reboot:
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: 'Update package cache if needed'
|
- name: 'Update package cache if needed'
|
||||||
become: true
|
become: true
|
||||||
|
@ -20,3 +24,17 @@
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
autoclean: true
|
autoclean: true
|
||||||
autoremove: true
|
autoremove: true
|
||||||
|
|
||||||
|
- name: 'Check if reboot is required'
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: '/var/run/reboot-required'
|
||||||
|
register: 'reboot_required_file'
|
||||||
|
|
||||||
|
- name: 'Reboot if required'
|
||||||
|
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