Hello,
I am an ansible newbie and I am trying to understand how to work with dicts.
The following playbook produces a syntax error, and we’re not sure why:
ansible-playbook --version
ansible-playbook 1.5.3
ansible-playbook -i ~/.ansible-hosts dict.yml --syntax-check
ERROR: parse error: playbooks must be formatted as a YAML list, got <type ‘dict’>
And here is the playbook (used from the ansible documentation) at http://docs.ansible.com/playbooks_loops.html#looping-over-hashes:
*ERROR: parse error: playbooks must be formatted as a YAML list, got <type
'dict'>*
And here is the playbook (used from the ansible documentation) at
http://docs.ansible.com/playbooks_loops.html#looping-over-hashes:
This is not a playbook, but two distinct snippets, the first from a vars
file, the second is just a tasks list.
Better have a look here http://docs.ansible.com/playbooks_intro.html to
understand how a playbook is structured.
Thanks for the pointer. I was missing the vars section. The following works as expected: