From 30f06e7bfb6b81ad12d648e1d2e38ce456f2f379 Mon Sep 17 00:00:00 2001 From: Ryan Hamilton Date: Mon, 26 May 2025 23:15:35 -0500 Subject: [PATCH] add playbook to check if a reboot is required --- playbooks/check-reboot-needed.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 playbooks/check-reboot-needed.yml diff --git a/playbooks/check-reboot-needed.yml b/playbooks/check-reboot-needed.yml new file mode 100644 index 0000000..078d188 --- /dev/null +++ b/playbooks/check-reboot-needed.yml @@ -0,0 +1,14 @@ +- name: Check if reboot is required + hosts: all + gather_facts: false + become: true + tasks: + - name: Check for /var/run/reboot-required + stat: + path: /var/run/reboot-required + register: reboot_flag + + - name: Display reboot status + debug: + msg: > + {{ inventory_hostname }} {{ 'requires' if reboot_flag.stat.exists else 'does not require' }} a reboot.