init commit

This commit is contained in:
2025-07-21 14:26:07 -05:00
commit 6a683a7a38
25 changed files with 635 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
- name: Check if reboot is required
hosts: all
gather_facts: false
become: true
vars:
reboot_machines: false # default, override via --extra-vars
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."
- name: Reboot if required and reboot_machines flag is true
reboot:
msg: "Rebooting due to /var/run/reboot-required"
pre_reboot_delay: 5
when:
- reboot_flag.stat.exists
- reboot_machines | bool