Interview Prep/Ansible/Rolling Updates, Delegation and Orchestration

Hosts need rebooting after a kernel patch, one at a time, and the play must wait for them to return.

IntermediateScenarioRolling Updates, Delegation and Orchestration
Answer

Situation read → Safe reboot.

What I'd do →

- hosts: all
  serial: 1
  tasks:
    - ansible.builtin.reboot:
        reboot_timeout: 900
        post_reboot_delay: 20
        test_command: systemctl is-system-running --wait

Why → The reboot module handles the disconnect, polls until SSH returns and runs a test command.

Interview tip → Never use shell: reboot with async; the module exists for this.

All Ansible questions Roadmap: Ansible

More on Rolling Updates, Delegation and Orchestration