Interview Prep/Ansible/Performance, Testing and CI/CD

You install 15 packages with a loop and it is slow.

BeginnerScenarioPerformance, Testing and CI/CD
Answer

Situation read → One module call per package means 15 round trips and 15 package-manager runs.

What I'd do →

- ansible.builtin.apt:
    name: [git, curl, htop, jq, unzip]
    state: present
    update_cache: true
    cache_valid_time: 3600

Why → The package manager resolves everything in one transaction.

Interview tip → cache_valid_time avoids repeated apt update.

All Ansible questions Roadmap: Ansible

More on Performance, Testing and CI/CD