Ansible forks, serial and Rolling Changes
forks and serial both control parallelism and they are not the same thing. Forks is how many hosts Ansible works on simultaneously; serial splits the play into batches that each complete fully before the next begins. That difference is what turns a play into a rolling deployment, and it is visible in the output.
Scale and Debugging Guide 37 of 45 Intermediate
- OSUbuntu 26.04 LTS
- ansible-core2.20.1
- Python3.14.4
- TimeAbout 15 min
serial accepts a number, a percentage (serial: 25%) or a list (serial: [1, 5, 10]) for a canary batch followed by progressively larger ones. Combined with max_fail_percentage it is how a large rollout is made safe - stop after the first batch if too much of it fails.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| ANS-CTL01 | 192.168.0.36 | Ubuntu 26.04 LTS | Ansible Control Node | 2 Core | 3 GB | 50 GB |
| ANS-A01 | 192.168.0.37 | Ubuntu 26.04 LTS | Managed Node (group: web) | 2 Core | 3 GB | 50 GB |
| ANS-B01 | 192.168.0.38 | Ubuntu 26.04 LTS | Managed Node (group: db) | 2 Core | 3 GB | 50 GB |
This guide includes
Use this when a change must not hit every host at once. This matters because forks and serial both control parallelism and are not the same thing - one is how many hosts run together, the other splits the play into batches.
- measuring
forks, which is how many hosts run at once - using
serialto turn one play into batches - using
run_onceanddelegate_tofor work that belongs on a single host - throttling one task rather than the whole play
Before you start
- A control node configured as shown in the first step.
- The session runs several short playbooks and changes nothing on the managed nodes.
-
The configuration this guide assumes
-
forks is how many hosts at once
-
serial turns one play into batches
-
run_once and delegate_to
-
Throttling one task