serial & Rolling Batch Execution
Roll changes out in safe waves.
serial & Rolling Batch Execution is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 4 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.
All at Once Is Risky
Updating every server in one sweep is fast, but a bad change can take down your whole fleet at the same instant. Rolling updates avoid that.
Meet serial
The serial keyword tells a play to work through hosts in batches instead of all together. You update a slice, then move to the next.
- hosts: web
serial: 2A Number Sets Batch Size
Give serial a number and each batch holds that many hosts. With serial 2, Ansible finishes the whole play on two hosts before touching the rest.
Use a Percentage
A percentage scales with fleet size. serial: 25% updates a quarter of hosts per wave, whether you have 8 servers or 800.
serial: 25%Ramp Up with a List
Pass a list to grow batches as confidence builds: start with one host, then more. This is the classic canary then full rollout pattern.
serial:
- 1
- 5
- 25%Whole Play, Per Batch
Crucially, serial runs the entire play on a batch before the next. The first slice is fully done while later hosts have not started.
Fail Fast with max_fail_percentage
Pair serial with max_fail_percentage to abort the rollout if too many hosts in a batch fail, stopping a bad change before it spreads.
- hosts: web
serial: 25%
max_fail_percentage: 30Drain Before You Touch
A safe wave first removes each batch from the load balancer, applies changes, then adds the hosts back so users never hit a server mid-update.
Keep the Service Up
Because other batches keep serving traffic, rolling updates give you zero downtime: the app stays available throughout the deploy.
serial Meets forks
Within a batch, forks still control parallelism. serial caps how many hosts a wave touches; forks caps how many run at once inside it.
Test on One First
Starting with serial: 1 makes the first host a canary. If it breaks, the run stops there and the rest of your fleet stays healthy.
Quick Check
You want to update 100 web servers a few at a time without an outage.
Recap
Use serial to roll changes out in batches, ramp with a list, and add max_fail_percentage to bail early. That is zero-downtime deploys. 🌊
Learn DevOps Bootcamp with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 142
- Lessons
- 568
Frequently Asked Questions
Is the “serial & Rolling Batch Execution” lesson free?
Yes — any 3 lessons of the DevOps Bootcamp learning path, including “serial & Rolling Batch Execution”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.
What will I learn in “serial & Rolling Batch Execution”?
Roll changes out in safe waves. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.
How long does the “serial & Rolling Batch Execution” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- forks & Parallelism Tuning
- Strategies: linear, free & host_pinned
- SSH Pipelining & Connection Reuse
- serial & Rolling Batch Execution