How do you scale Ansible to thousands of hosts?
AdvancedProductionPerformance and Scale
Answer
Do not fix it with just one big controller:
- Tune the basics: pipelining, ControlPersist, caching, fewer tasks, async.
- Split the work: run per environment, per region or per tier in parallel pipeline jobs with
--limit. - Distribute execution: AAP automation mesh or several AWX execution nodes and instance groups close to the hosts (per region/datacenter), with hop nodes for isolated networks.
- Use pull mode (
ansible-pull) for autoscaled or very large fleets that configure themselves, with a central repo. - Shrink the problem: bake images so that day-to-day runs configure little.
Watch controller memory (each fork costs RAM), inventory sync time, and the load your automation puts on shared services such as mirrors and APIs.
More on Performance and Scale
Why can Ansible be slower than a shell script for 100 servers, and what dominates the time?BeginnerHow do you choose the `forks` value?BeginnerWhat is SSH pipelining and why does it help?BeginnerWhich SSH settings matter for performance and stability?IntermediateHow do you find out which tasks are slow?BeginnerHow do you reduce the cost of fact gathering?Intermediate