--- # PURPOSE: Reboot hosts # DESCRIPTION: Reboot selected hosts in batches and wait for management connectivity. # TARGETS: linux, windows # INPUTS (omitted values inherit inventory / role defaults): # aim_debug [bool]: false # maintenance_reboot_serial [serial]: 10 # maintenance_reboot_timeout [int]: 1800 # maintenance_reboot_message [text]: Reboot initiated by debsansible01.bfmiglabor.lan (Ansible) # maintenance_reboot_pre_delay [int]: 0 # maintenance_reboot_post_delay [int]: 15 # AUTH: existing inventory / Vault credentials; no embedded passwords. # CHANGES: Every selected host will be rebooted. No reboot occurs before final confirmation. # EXAMPLE: ansible-playbook -i inventories//hosts.yml # playbooks/maintenance_reboot_hosts.yml --limit --vault-id @prompt - name: Maintenance | Reboot Linux hosts: linux gather_facts: true pre_tasks: - name: AIM | Validate diagnostics option ansible.builtin.assert: that: - (aim_debug | default(false)) is boolean or (aim_debug | default(false) | string | lower) in ['true', 'false'] fail_msg: aim_debug must be a YAML/JSON boolean. quiet: true - name: AIM | Reject mixed platform membership ansible.builtin.assert: that: - (group_names | intersect(['linux', 'windows', 'sophosxgs', 'pfsense']) | length) <= 1 fail_msg: This host belongs to incompatible platform groups. Use globally unique subgroups. quiet: true - name: AIM | Execution context ansible.builtin.debug: msg: host: '{{ inventory_hostname }}' diagnostics: Enabled; secret values are never included by this task. when: aim_debug | default(false) | bool become: true serial: '{{ maintenance_reboot_serial | default(10) }}' roles: - role: maintenance_reboot_hosts - name: Maintenance | Reboot Windows hosts: windows gather_facts: false pre_tasks: - name: AIM | Validate diagnostics option ansible.builtin.assert: that: - (aim_debug | default(false)) is boolean or (aim_debug | default(false) | string | lower) in ['true', 'false'] fail_msg: aim_debug must be a YAML/JSON boolean. quiet: true - name: AIM | Reject mixed platform membership ansible.builtin.assert: that: - (group_names | intersect(['linux', 'windows', 'sophosxgs', 'pfsense']) | length) <= 1 fail_msg: This host belongs to incompatible platform groups. Use globally unique subgroups. quiet: true - name: AIM | Execution context ansible.builtin.debug: msg: host: '{{ inventory_hostname }}' diagnostics: Enabled; secret values are never included by this task. when: aim_debug | default(false) | bool serial: '{{ maintenance_reboot_serial | default(10) }}' roles: - role: maintenance_reboot_hosts