---
- name: Read-only managed-update preflight
  hosts: all
  gather_facts: true
  become: false
  tasks:
    - name: Report host summary
      ansible.builtin.debug:
        msg:
          host: "{{ inventory_hostname }}"
          ansible_host: "{{ ansible_host | default('unknown') }}"
          update_class: "{{ update_class | default('unset') }}"
          service_role: "{{ service_role | default('unset') }}"
          distribution: "{{ ansible_distribution }} {{ ansible_distribution_version }}"
          kernel: "{{ ansible_kernel }}"
          runbook: "{{ runbook | default('unset') }}"

    - name: Check reboot-required marker
      ansible.builtin.stat:
        path: /var/run/reboot-required
      register: reboot_required

    - name: Report reboot marker
      ansible.builtin.debug:
        msg:
          reboot_required: "{{ reboot_required.stat.exists }}"
