An administrator runs a playbook with the serial keyword set to 2. The playbook targets 6 hosts and contains a task that runs a rolling update. During execution, the administrator notices that the task is executed on only 2 hosts at a time, but the playbook waits for all tasks to complete on those 2 hosts before moving to the next 2. What is the primary effect of the serial keyword in this scenario?
The serial keyword defines the number of hosts to manage in each batch. With serial: 2, Ansible runs the entire play on 2 hosts, then the next 2, and so on, ensuring tasks complete on one batch before proceeding to the next. This is correct because it controls batch size and provides rolling updates.
Why this answer
The serial keyword controls how many hosts are included in each batch of a play. When set to 2, Ansible completes the entire play on the first 2 hosts before moving to the next 2. This provides rolling updates and limits the impact of failures.
It does not affect parallelism within a batch or limit the total number of hosts.
Exam trap
The trap here is confusing serial with forks or throttle, which control parallelism and task concurrency rather than host batching.