Interview Prep/Ansible/Performance and Scale

Why can Ansible be slower than a shell script for 100 servers, and what dominates the time?

BeginnerProductionPerformance and Scale
Answer

Ansible does far more per step: for each task and host it opens or reuses an SSH connection, creates a temp dir, transfers a module payload, executes Python, parses JSON, and cleans up. Fact gathering adds a large setup run at the start of every play, and the default linear strategy makes each task wait for the slowest host, with only 5 hosts in parallel (the default forks).

In real playbooks the time sits in three places: fact gathering, a large number of small tasks, and slow tasks such as package installs or downloads. Measure with profile_tasks before tuning.

All Ansible questions Roadmap: Ansible

More on Performance and Scale