DevOps / Ansible Interview questions
How can you optimize a large-scale Ansible deployment for performance?
- Raise forks well above the default to match available control-node CPU/network capacity, so more hosts run truly in parallel.
- Enable persistent fact caching (Redis or similar) so a large inventory doesn't re-gather facts on every single run.
- Use the free strategy for independent hosts so faster hosts aren't bottlenecked waiting for the slowest host on every task.
- Enable SSH pipelining and connection reuse (ControlPersist) to cut per-task SSH connection overhead significantly at scale.
- Split very large inventories into batches with serial, so a single run doesn't try to open thousands of simultaneous connections at once.
- Move to Execution Environments / Ansible Automation Platform for scheduling, job isolation, and horizontal scaling of control-node capacity itself when a single control node becomes the bottleneck.
At large scale, the bottleneck is usually connection and fact-gathering overhead multiplied across thousands of hosts rather than task logic itself, so most of these optimizations target reducing per-host overhead and increasing safe parallelism rather than rewriting playbooks.
More Related questions...