Welcome to my blog
Check Ansible syntax
Syntax Check Ansible has a built-in utility to validate the syntax of your yaml files. Add --syntax-check to your ansible-playbook execution and the yaml parser will validate your file formatting without running tasks. 1 $ ansible-playbook ping.yml --syntax-check If your playbook passes the check, the output is rather boring. 1 2 $ ansible-playbook unarchive.yaml --syntax-check playbook: unarchive.yaml The interpreter for --syntax-check strictly cares about whether it can interpret raw yaml and cares nothing for best practices like naming all your tasks, deprecated modules, idempotency, missing metadata, or spacing in your variable invocations....
Troubleshooting Ansible tests
Troubleshooting Molecule Ignoring errors Sometimes a task or handler will fail in Molecule tests which you know won’t fail in your live environment. To ignore the failure just for the Molecule environment, add a test for the value of MOLECULE_FILE in the runtime environment. 1 2 3 4 5 6 - name:Start service.service:name:special-agent-snoopystate:startedlisten:start-serviceignore_errors:lookup('env', 'MOLECULE_FILE') Debug messages First, turn on debug mode in Molecule molecule --debug test. When an Ansible stage in executed by Molecule against your test instance, it may fail, un-helpfully telling you that it cannot display the error because no_log: true....