feat: add check for reboot requirement before server reboot in yum_updates.yaml

This commit is contained in:
2025-09-10 09:11:19 -04:00
parent 668d423e2b
commit 8db1bcbfda
+6
View File
@@ -21,6 +21,12 @@
path: /var/run/needs-restarting path: /var/run/needs-restarting
register: reboot_required_file 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 - name: Reboot the server if required
ansible.builtin.reboot: ansible.builtin.reboot:
msg: "System is going down for reboot after package updates." msg: "System is going down for reboot after package updates."