Lets see how to verify if our ansible YML playbook syntax is fine and has no errors in it.
To do this check we need to add “–syntax-check” option after the playbook run command.
1. Ansible YML Playbook Syntax Check
$ ansible-playbook playbooks/thirdplay.yml --syntax-check playbook: playbooks/thirdplay.yml
2. Check Result in case of an error
$ ansible-playbook playbooks/thirdplay.yml --syntax-check ERROR! Syntax Error while loading YAML. mapping values are not allowed here The error appears to have been in '/Users/saket1447583/ansible/playbooks/thirdplay.yml': line 2, column 8, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: ----- - name: "Copying test.html file" ^ here $