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.
More on Testing, CI/CD and Quality
What does a testing pyramid look like for Ansible code?BeginnerHow do you roll out `ansible-lint` profiles across a team without blocking everyone?IntermediateWhen do you use `skip_list`, `warn_list` and `# noqa`?IntermediateHow do you set up pre-commit hooks for an Ansible repo?BeginnerHow is a Molecule scenario laid out, and what does `molecule test` actually run?IntermediateDocker, Podman or real VMs as the Molecule driver: how do you choose?Advanced