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

What does `--syntax-check` miss, and what catches it?

BeginnerProductionTesting, CI/CD and Quality
Answer

ansible-playbook --syntax-check only parses YAML and the play structure. It does not catch:

  • Undefined variables and broken Jinja2 expressions (they fail at run time).
  • Wrong module parameters, or modules from collections that are not installed in that environment.
  • Logic errors, idempotence issues and wrong file permissions.
ansible-playbook --syntax-check playbooks/site.yml   # structure only
ansible-lint playbooks/                              # modules, args, best practices
ansible-playbook playbooks/site.yml --check --diff -l staging   # real variable resolution

So a green syntax check is the minimum, not proof. Lint plus a check-mode run against a real inventory catches far more.

All Ansible questions Roadmap: Ansible

More on Testing, CI/CD and Quality