# register into a hash table?

**URL:** <https://forum.ansible.com/t/register-into-a-hash-table/14094>\
**Category:** Ansible Project\
**Created:** [December 6, 2013, 8:15pm UTC](https://forum.ansible.com/t/register-into-a-hash-table/14094 "2013-12-06T20:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xu\_Chen](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@Xu\_Chen](https://forum.ansible.com/u/Xu_Chen)\
**Post date:** [December 6, 2013, 8:15pm UTC](https://forum.ansible.com/t/register-into-a-hash-table/14094/1 "2013-12-06T20:15:31Z")

</div>

I am interested in doing something like this:

- name: loop over items  
shell: cat /path/{{ item }}  
with\_items:
- t1
- t2
- t3  
register: result[{{ item }}]

Then I can do something like:

- name: use the result hashtable  
shell: echo /path/{{ result[item].stdout }}  
with\_items:
- t1
- t2

Is this possible? Thanks…

---

<div class="post-metadata">

**Author:** ![Xu\_Chen](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@Xu\_Chen](https://forum.ansible.com/u/Xu_Chen)\
**Post date:** [December 6, 2013, 8:29pm UTC](https://forum.ansible.com/t/register-into-a-hash-table/14094/2 "2013-12-06T20:29:09Z")

</div>

I tried something like this, but it doesn’t work:

- name: loop over items  
shell: cat /path/{{ item }}  
with\_items:
- t1
- t2
- t3  
register: output

Then I can do something like:

- name: use the result hashtable  
shell: echo /path/{{ output.results[loop.index0].stdout }}  
with\_items:
- t1
- t2
- t3

loop doesn’t seem to work in the task file…

---

<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:** [December 6, 2013, 8:39pm UTC](https://forum.ansible.com/t/register-into-a-hash-table/14094/3 "2013-12-06T20:39:48Z")

</div>

​No, register doesn't work like that, it just takes a simple string.​
