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.
More on Rolling Updates, Delegation and Orchestration
You must deploy a new app version to 40 web servers behind a load balancer with zero downtime.AdvancedWhat does `serial: [1, 5, "50%"]` do?BeginnerDuring a rolling update, 3 of 10 hosts in a batch fail. Does the play continue?IntermediateYou must restart database replicas one at a time but never the primary first.AdvancedA shell command must run on localhost for each remote host, e.g. a CLI call to a cloud API.BeginnerA deployment should run strictly one host at a time, but fact gathering should not be slow.Intermediate