0Pricing
Ansible Academy · Lesson

forks & Parallelism Tuning

Scale how many hosts run at once.

forks & Parallelism Tuning is a free Ansible Academy lesson on CoddyKit — lesson 1 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.

One at a Time Is Slow

By default Ansible touches only a handful of hosts at once. Across hundreds of servers, that serial pace turns a quick play into a long wait. ⏳

Meet the forks Setting

The forks value sets how many hosts Ansible drives in parallel for each task. More forks means more machines working at the same moment.

The Default Is Just 5

Out of the box forks is only 5. With 200 hosts, Ansible processes them in 40 waves, one batch of five finishing before the next begins.

Raise It in ansible.cfg

Set a higher default in your ansible.cfg so every run uses it. This is the cleanest place to tune parallelism for a project.

[defaults]
forks = 50

Override on the Command Line

Use the --forks flag (or -f) for a one-off run. It beats the config value without you editing any files.

ansible-playbook site.yml --forks 50

Tasks Run Lockstep

Forks parallelize a single task across hosts, but Ansible still waits for all hosts to finish a task before starting the next one.

The Control Node Pays

Each fork is a process on your control node. Hundreds of forks burn its CPU, memory and open SSH connections, so the machine itself is the limit.

Find Your Sweet Spot

There is no perfect number. Benchmark a few values like 25, 50 and 100, then pick the one that runs fastest without overloading your control node.

Mind the Slowest Host

Even with high forks, a task only advances when the slowest host in the batch responds. One laggard can stall the whole wave.

Forks Cap the Strategy

Forks set the ceiling on concurrency. The strategy plugin then decides how hosts move through that pool, so the two settings work together.

Watch the SSH Storm

Big fork counts open many SSH sessions at once. Combine high forks with pipelining and connection reuse to keep that overhead in check.

Quick Check

Your play crawls across 300 hosts and you want it faster.

Recap

Raise forks in ansible.cfg or with --forks to run more hosts at once. The default of 5 is low, but your control node sets the real ceiling. 🚀

Frequently asked questions

Is the “forks & Parallelism Tuning” lesson free?

Yes — the full text of “forks & Parallelism Tuning” 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 “forks & Parallelism Tuning”?

Scale how many hosts run at once. 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 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “forks & Parallelism Tuning” 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

  1. forks & Parallelism Tuning
  2. Strategies: linear, free & host_pinned
  3. SSH Pipelining & Connection Reuse
  4. serial & Rolling Batch Execution
← Back to Ansible Academy