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

A pipeline step must fail if a run had any `changed` tasks (drift detection).

IntermediateScenarioPerformance, Testing and CI/CD
Answer

Situation read → Use Ansible as a drift checker.

What I'd do → Run in check mode and parse the recap, or use the JSON callback.

ANSIBLE_STDOUT_CALLBACK=json ansible-playbook site.yml --check > out.json
jq '[.stats[] | .changed] | add' out.json

Fail when the sum is greater than zero.

Why → In check mode changed means "would change", which is drift.

Interview tip → Schedule it in AWX nightly with notifications.

All Ansible questions Roadmap: Ansible

More on Performance, Testing and CI/CD