# implementing hashes

**URL:** <https://forum.ansible.com/t/implementing-hashes/15709>\
**Category:** Ansible Project\
**Created:** [July 18, 2014, 6:58pm UTC](https://forum.ansible.com/t/implementing-hashes/15709 "2014-07-18T18:58:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon\_Metcalf](https://avatars.discourse-cdn.com/v4/letter/b/8e7dd6/32.png) [@Brandon\_Metcalf](https://forum.ansible.com/u/Brandon_Metcalf)\
**Post date:** [July 18, 2014, 6:58pm UTC](https://forum.ansible.com/t/implementing-hashes/15709/1 "2014-07-18T18:58:17Z")

</div>

It seems this should work according to the docs. It does work if I use

with\_items: app1

$ cat jj.yml

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 19, 2014, 12:00pm UTC](https://forum.ansible.com/t/implementing-hashes/15709/2 "2014-07-19T12:00:05Z")

</div>

In the above, app1 and app2 are not hashes, but lists of strings.

I think you would want to define them like:

app2: { base: “foo” }

etc

But really probably

apps:

- { name: app1, base: foo }
- { name: app2, base: bar }

tasks:

- blarg: …  
with\_items: apps

Etc.

Let me know if you’d like more detail on some of the above, but that should get you started.

---

<div class="post-metadata">

**Author:** ![Brandon\_Metcalf](https://avatars.discourse-cdn.com/v4/letter/b/8e7dd6/32.png) [@Brandon\_Metcalf](https://forum.ansible.com/u/Brandon_Metcalf)\
**Post date:** [July 21, 2014, 2:14pm UTC](https://forum.ansible.com/t/implementing-hashes/15709/3 "2014-07-21T14:14:54Z")

</div>

Thanks, Michael. I was able to get something like that working. However, what I ultimately need is the ability to control the order in which app1 and app2 are operated on within certain tasks. For some tasks, I need to operate on app1 first and for others app2 first.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 21, 2014, 11:14pm UTC](https://forum.ansible.com/t/implementing-hashes/15709/4 "2014-07-21T23:14:38Z")

</div>

You could still keep the data in the hash and then traverse an array.

thing\_details[item][‘hash\_key’]

where thing\_details is a hash

and you’re traversing across a with\_items: thing\_names
