Playbook Runtime Calculator
Estimate total Ansible playbook execution time across tasks, hosts and forks.
About Playbook Runtime Calculator
Ansible processes hosts in parallel batches sized by --forks; each task must complete across the current batch before the next task starts, so total runtime is driven by the number of batches, not the raw host count. Formula: runtime = ceil(hosts / forks) × tasks × avg_task_duration + fact_gathering_time. Increasing forks reduces the number of batches (up to the point where forks ≥ hosts, i.e. full parallelism in one batch).
Formula
runtime_sec = ceil(hosts / forks) × tasks × avg_task_duration + ceil(hosts / forks) × fact_gathering_per_batch
- hosts
- Number of target hosts
- forks
- Ansible parallelism (--forks)
- tasks
- Number of tasks in the playbook
- avg_task_duration
- Average seconds per task per host
- fact_gathering_per_batch
- Seconds for fact gathering per batch
Worked example
With the default values below, Playbook Runtime Calculator returns Estimated Playbook Runtime of 12.83. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Host Countaccepts 1–1,000,000 hosts
- 100 hosts
- Task Countaccepts 1–100,000 tasks
- 25 tasks
- Avg Task Durationaccepts 0.1–3,600 sec
- 3 sec
- Forks (Parallelism)accepts 1–10,000 forks
- 10 forks
- Fact Gathering Timeaccepts 0–600 sec per batch
- 2 sec per batch
Results
- Estimated Playbook Runtime
- 12.83 min
- Estimated Playbook Runtime
- 770.0 sec
- Parallel Batches
- 10
- Speedup vs Serial (forks=1)
- 9.74 ×
Step by step
- 1Parallel batches: ceil(hosts / forks)= 10 batches
- 2Task execution time: batches × tasks × avg duration= 750.0s
- 3Fact gathering time: batches × per-batch duration= 20.0s
- 4Total runtime= 770.0s (12.83 min)
Assumptions and limits
- The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
What's a good forks value?
Ansible's default is 5, which is conservative for most use cases. Values of 20-50+ are common in production for large fleets, limited mainly by the control node's CPU/memory/network and how much load you're willing to put on target hosts simultaneously.
Why does fact gathering add time per batch, not per host?
Fact gathering (the implicit 'setup' task) runs in parallel across each batch just like any other task, so its cost is incurred once per batch of forks hosts, not once per individual host — this calculator models it as a fixed per-batch cost.
How can I speed up a slow playbook beyond increasing forks?
Disable fact gathering when not needed (gather_facts: false), use free strategy instead of linear to avoid waiting for the slowest host in each batch, enable pipelining, and use async/poll for long-running tasks.
Does network latency to hosts affect this estimate?
Yes — 'avg task duration' should include SSH connection and round-trip overhead, not just module execution time; measure this from real playbook runs (ansible-playbook -vvv or callback plugins) for an accurate baseline.
Related Calculators
You might also need
- Task Execution Time CalculatorCommonly used together
- Ansible Forks CalculatorCommonly used together
- Host Parallelism CalculatorCommonly used together
- Module Execution Time CalculatorCommonly used together
- Fact Gathering Time CalculatorCommonly used together
- Inventory Size CalculatorCommonly used together
