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

What would a Molecule `verify.yml` check for an Nginx role?

IntermediateScenarioPerformance, Testing and CI/CD
Answer

Situation read → Assertions on the end state.

What I'd do →

- name: Verify
  hosts: all
  gather_facts: false
  tasks:
    - ansible.builtin.service_facts:
    - ansible.builtin.assert:
        that: "ansible_facts.services['nginx.service'].state == 'running'"
    - ansible.builtin.uri:
        url: http://localhost
        status_code: 200

Why → Assert behaviour (running, listening, responding), not implementation details.

Interview tip → Testinfra (Python) is the older verifier option.

All Ansible questions Roadmap: Ansible

More on Performance, Testing and CI/CD