Estimate total Ansible playbook execution time across tasks, hosts and forks.
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).
runtime_sec = ceil(hosts / forks) × tasks × avg_task_duration + ceil(hosts / forks) × fact_gathering_per_batch
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.
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.
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.
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.