Interview Prep/Ansible/Rolling Updates, Delegation and Orchestration

A play must act on a host that is unreachable at the start but may come back soon.

AdvancedScenarioRolling Updates, Delegation and Orchestration
Answer

Situation read → Unreachable hosts are dropped from the play.

What I'd do → Use wait_for_connection early, and meta: clear_host_errors to re-include hosts that failed earlier.

- hosts: all
  gather_facts: false
  tasks:
    - ansible.builtin.wait_for_connection: { timeout: 300 }
    - ansible.builtin.setup:

Why → Hosts marked unreachable stay out for the rest of the play; waiting before facts gathering prevents that.

Interview tip → meta: clear_host_errors resets failed state for the play.

All Ansible questions Roadmap: Ansible

More on Rolling Updates, Delegation and Orchestration