A deployment should run strictly one host at a time, but fact gathering should not be slow.
IntermediateScenarioRolling Updates, Delegation and Orchestration
Answer
Situation read → serial: 1 gathers facts per batch, increasing wall time.
What I'd do → Gather facts in a first play for all hosts, then run the serial play with gather_facts: false, or with cached facts.
- hosts: web
gather_facts: true
tasks: []
- hosts: web
serial: 1
gather_facts: false
Why → Facts are collected in parallel once, not 40 times sequentially.
Interview tip → Facts live in memory for the whole run, so the second play still sees them.
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.AdvancedYou need a task to run on the LB for every web host, without logging into each web host.IntermediateA shell command must run on localhost for each remote host, e.g. a CLI call to a cloud API.Beginner