less than 1 minute read

Using python yaml module

python -c 'import yaml, sys; print yaml.load(sys.stdin);' < my_playbook.yml

If no syntax error exists, Python prints the contents of the YAML file to stdout in JSON format.

The example here shows the use of the Python method on a YAML file with valid syntax.

Use –syntax-check option

ansible-playbook --syntax-check my_playbook.yml

Leave a comment