# Working with dicts

**URL:** <https://forum.ansible.com/t/working-with-dicts/14902>\
**Category:** Ansible Project\
**Created:** [March 31, 2014, 10:25pm UTC](https://forum.ansible.com/t/working-with-dicts/14902 "2014-03-31T22:25:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Premanand\_Chandrasek](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@Premanand\_Chandrasek](https://forum.ansible.com/u/Premanand_Chandrasek)\
**Post date:** [March 31, 2014, 10:25pm UTC](https://forum.ansible.com/t/working-with-dicts/14902/1 "2014-03-31T22:25:51Z")

</div>

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:](http://docs.ansible.com/playbooks_loops.html#looping-over-hashes:)

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [April 1, 2014, 2:25pm UTC](https://forum.ansible.com/t/working-with-dicts/14902/2 "2014-04-01T14:25:49Z")

</div>

> \*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:](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](http://docs.ansible.com/playbooks_intro.html) to  
understand how a playbook is structured.

---

<div class="post-metadata">

**Author:** ![Premanand\_Chandrasek](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@Premanand\_Chandrasek](https://forum.ansible.com/u/Premanand_Chandrasek)\
**Post date:** [April 2, 2014, 1:51am UTC](https://forum.ansible.com/t/working-with-dicts/14902/3 "2014-04-02T01:51:47Z")

</div>

Thanks for the pointer. I was missing the vars section. The following works as expected:
