diff --git a/yum_updates.yaml b/yum_updates.yaml index c1c5ba2..0ecc118 100644 --- a/yum_updates.yaml +++ b/yum_updates.yaml @@ -21,6 +21,12 @@ path: /var/run/needs-restarting register: reboot_required_file + - name: Reboot the server if required + ansible.builtin.reboot: + msg: "System is going down for reboot after package updates." + when: reboot_check.rc == 1 # needs-restarting -r returns 1 if a reboot is needed + + # - name: Reboot if required # ansible.builtin.reboot: # reboot_timeout: 120 # Adjust timeout as needed