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

Design a CI pipeline for an Ansible repo.

AdvancedScenarioPerformance, Testing and CI/CD
Answer

Situation read → End-to-end quality gates.

What I'd do →

  1. Lint: yamllint, ansible-lint.
  2. Syntax: ansible-playbook --syntax-check for each playbook.
  3. Unit/integration: Molecule per changed role.
  4. Dry run on staging: --check --diff.
  5. Deploy to staging; smoke tests.
  6. Manual approval; deploy to prod with serial.
flowchart LR
  A["Commit"] --> B["Lint"] --> C["Syntax check"] --> D["Molecule"] --> E["Staging check mode"] --> F["Staging deploy"] --> G["Approval"] --> H["Prod rolling deploy"]

Why → Cheaper checks run first; expensive ones only after they pass.

Interview tip → Run only changed roles in Molecule to keep the pipeline fast.

All Ansible questions Roadmap: Ansible

More on Performance, Testing and CI/CD