# Looping over a hash Subelement

**URL:** <https://forum.ansible.com/t/looping-over-a-hash-subelement/19359>\
**Category:** Ansible Project\
**Created:** [September 25, 2015, 4:50pm UTC](https://forum.ansible.com/t/looping-over-a-hash-subelement/19359 "2015-09-25T16:50:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luis\_Oscar\_Ramos\_Car](https://avatars.discourse-cdn.com/v4/letter/l/9fc348/32.png) [@Luis\_Oscar\_Ramos\_Car](https://forum.ansible.com/u/Luis_Oscar_Ramos_Car)\
**Post date:** [September 25, 2015, 4:50pm UTC](https://forum.ansible.com/t/looping-over-a-hash-subelement/19359/1 "2015-09-25T16:50:23Z")

</div>

Hi,

I would like to do something like the example in [Looping over Subelements](http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-subelements) but using a hash instead of a list.

`

---

<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:** [September 25, 2015, 4:57pm UTC](https://forum.ansible.com/t/looping-over-a-hash-subelement/19359/2 "2015-09-25T16:57:01Z")

</div>

Can you show the task how you try that?

---

<div class="post-metadata">

**Author:** ![Luis\_Oscar\_Ramos\_Car](https://avatars.discourse-cdn.com/v4/letter/l/9fc348/32.png) [@Luis\_Oscar\_Ramos\_Car](https://forum.ansible.com/u/Luis_Oscar_Ramos_Car)\
**Post date:** [September 25, 2015, 6:48pm UTC](https://forum.ansible.com/t/looping-over-a-hash-subelement/19359/3 "2015-09-25T18:48:17Z")

</div>

I was trying to follow with\_dic notation,

`

- command: echo {{ item.0.value.name }} {{ item.1 }}  
with\_subelements:
- users
- authorized  
`

but then I just used directly the name property and it worked:

`

- command: echo {{ item.0.name }} {{ item.1 }}  
with\_subelements:
- users
- authorized  
`

I apologize for wasting your time.
