Interview Prep/Ansible/Performance and Scale

How do you cut down the number of tasks without hurting readability?

IntermediateProductionPerformance and Scale
Answer

Prefer one template over a dozen lineinfile edits, pass lists to modules that accept them, use copy or synchronize on a directory instead of looping over files, and drop tasks that only gather information you can get from facts.

Combine several shell commands into a script only when each step is inherently non-idempotent anyway. Do not merge unrelated actions into mega-tasks to save seconds: you lose clear change reporting. The goal is the minimum number of round trips for the same state, not the minimum number of lines.

All Ansible questions Roadmap: Ansible

More on Performance and Scale