Interview Prep/Ansible/Rolling Updates, Delegation and Orchestration

You need a task to run on the LB for every web host, without logging into each web host.

IntermediateScenarioRolling Updates, Delegation and Orchestration
Answer

Situation read → delegate_to use.

What I'd do → Use delegate_to: lb01 on the task; it runs on the LB once per web host, with inventory_hostname still the web host.

Why → Useful for registering and deregistering backends, DNS updates and monitoring downtimes.

Interview tip → Add run_once: true only if the action should happen a single time.

All Ansible questions Roadmap: Ansible

More on Rolling Updates, Delegation and Orchestration