Strategies: linear, free & host_pinned
Change how plays sweep hosts.
Strategies: linear, free & host_pinned is a free Ansible Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ansible Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Strategy Sets the Pace
A strategy plugin decides how hosts march through the tasks of a play. It controls whether they move in step or each go at their own speed.
linear Is the Default
The default linear strategy runs one task on every host, waits for all to finish, then moves to the next task together.
- hosts: web
strategy: linearWhy linear Can Drag
With linear, the slowest host on each task holds everyone back. Fast servers sit idle waiting for the laggard before the play advances.
free Lets Hosts Sprint
The free strategy removes the wall. Each host races through its tasks as fast as it can, never waiting for the others to catch up.
- hosts: web
strategy: freefree Trades Order for Speed
With free, hosts finish at different times and output interleaves. You gain speed but lose the tidy task-by-task synchronization.
When free Shines
Reach for free when hosts are independent and some are much slower. Avoid it when one host must finish a step before another begins.
Meet host_pinned
The host_pinned strategy keeps a worker glued to one host until that host is done, instead of round-robining across the whole fleet.
- hosts: web
strategy: host_pinnedWhy Pinning Helps
By finishing hosts fully before grabbing new ones, host_pinned caps how many machines are touched at once, easing load on backends like a license server.
Set It Per Play
Strategy is a play-level key, so different plays in one file can use different strategies. Pick the best fit for each phase of work.
Or Set a Default
Choose a project-wide default under the strategy key in ansible.cfg. The per-play setting still wins whenever you override it.
[defaults]
strategy = freeStrategy Plus Forks
Strategy decides how hosts flow, while forks caps how many run at once. Tune both together to get the throughput you want.
Quick Check
One host in your batch is far slower than the rest and stalls the play.
Recap
linear keeps hosts in step, free lets them sprint independently, and host_pinned finishes one host before starting the next. Pick per play. 🏁
Frequently asked questions
Is the “Strategies: linear, free & host_pinned” lesson free?
Yes — the full text of “Strategies: linear, free & host_pinned” is free to read here on the web, and the Ansible Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ansible Academy course, upgrade to CoddyKit PRO.
What will I learn in “Strategies: linear, free & host_pinned”?
Change how plays sweep hosts. You practise Ansible Academy 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 Ansible Academy?
No prior experience is required. Ansible Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Strategies: linear, free & host_pinned” 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 Ansible Academy lesson?
Yes. Every Ansible Academy 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