How do you run a quick syntax and dry run check on all playbooks locally before pushing?
BeginnerScenarioPerformance, Testing and CI/CD
Answer
Situation read → Fast local feedback.
What I'd do →
ansible-playbook playbooks/*.yml --syntax-check
ansible-lint
yamllint .
Add them as a pre-commit hook.
Why → Syntax check catches parse errors; lint catches bad practice.
Interview tip → --syntax-check doesn't validate module arguments; Molecule and check mode do.
More on Performance, Testing and CI/CD
A playbook that touches 200 hosts takes 40 minutes. Where do you start tuning?IntermediateYou install 15 packages with a loop and it is slow.BeginnerHow would you test a role in CI before it reaches production?IntermediateWhat would a Molecule `verify.yml` check for an Nginx role?IntermediateMolecule's idempotence step fails. How do you find the offending task?IntermediateDesign a CI pipeline for an Ansible repo.Advanced