From 8db1bcbfda3c04f959066d0e69216067517889f4 Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Wed, 10 Sep 2025 09:11:19 -0400 Subject: [PATCH] feat: add check for reboot requirement before server reboot in yum_updates.yaml --- yum_updates.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yum_updates.yaml b/yum_updates.yaml index 0ecc118..3432fae 100644 --- a/yum_updates.yaml +++ b/yum_updates.yaml @@ -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."