feat: add check for reboot requirement before server reboot in yum_updates.yaml
This commit is contained in:
@@ -21,6 +21,12 @@
|
||||
path: /var/run/needs-restarting
|
||||
register: reboot_required_file
|
||||
|
||||
- name: Check if a reboot is required
|
||||
ansible.builtin.command: needs-restarting -r
|
||||
register: reboot_check
|
||||
ignore_errors: yes # Important: The command returns a non-zero exit code if a reboot is needed
|
||||
changed_when: false # This command does not change the system state
|
||||
|
||||
- name: Reboot the server if required
|
||||
ansible.builtin.reboot:
|
||||
msg: "System is going down for reboot after package updates."
|
||||
|
||||
Reference in New Issue
Block a user