1
0
Fork 0

Added reboot if required by updates
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Nis Wechselberg 2025-06-19 20:38:08 +02:00
parent f1925fbc5b
commit 6847b8f14a

View file

@ -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'