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

How would you test a role in CI before it reaches production?

IntermediateScenarioPerformance, Testing and CI/CD
Answer

Situation read → Automated role testing.

What I'd do → Use Molecule with a container driver (Docker/Podman).

# molecule/default/molecule.yml
driver: { name: docker }
platforms:
  - name: ubuntu24
    image: geerlingguy/docker-ubuntu2404-ansible
    pre_build_image: true
    command: ""
    privileged: true
provisioner: { name: ansible }
verifier: { name: ansible }
molecule test      # create, converge, idempotence, verify, destroy

Why → The sequence proves the role applies, is idempotent, and meets assertions.

Interview tip → Add a matrix of OS images to check portability.

All Ansible questions Roadmap: Ansible

More on Performance, Testing and CI/CD