when ever i try to write something in ansible yml file it always show me syntax error.
well a lot of this tools are to do that more automated or give you more insight before you get to the point of running them.
Hi
when ever i try to write something in ansible yml file it always show me syntax error.
Start by reading this: https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
Beware of the spaces/intendation you use. If you have a list like this:
fruits:
- Apple
- Orange
- Strawberry
- Mango
All the dashes are in one line (column) and the dash starts 4 spaces after the line starts. Always write your yml files like this and avoid mixed intendations like:
fruits:
- Apple
- Orange
- Strawberry
- Mango
You can also use the --syntax-check flag with ansible-playbook command on your yaml files. But it might produce errors even if there are none.
Furthermore if you start a new yaml file start with as less stuff in it as possible and test it out. Then add more stuff and test again. It is really hard to find a mistake in a 100 line long file. Much easier if you only have three lines. So start with
fruits:
- Apple
Then when you can run that without errors you can add more fruits to the list etc.
Hope it helps,
Cyril