# Anisble , Jinja2  create list of hashes

**URL:** <https://forum.ansible.com/t/anisble-jinja2-create-list-of-hashes/20093>\
**Category:** Ansible Project\
**Created:** [December 29, 2015, 2:31pm UTC](https://forum.ansible.com/t/anisble-jinja2-create-list-of-hashes/20093 "2015-12-29T14:31:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerhardjadzkadzikise](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@gerhardjadzkadzikise](https://forum.ansible.com/u/gerhardjadzkadzikise)\
**Post date:** [December 29, 2015, 2:31pm UTC](https://forum.ansible.com/t/anisble-jinja2-create-list-of-hashes/20093/1 "2015-12-29T14:31:29Z")

</div>

Hello,

I am using Ansible 2.0.0 devel version and i want to create list of hashes in my playbook.

For example i have one variable jkl11 with structure:

debug msg={{ jkl11 }}] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“changed”: false,  
“msg”: [  
[  
[  
“e0c9cf47-00f2-4909-84a5-d3db7cbf61f3”,  
“app”,  
“2015-12-29”  
]  
],  
[  
[  
“0b3d86bb-8acb-4d27-8d51-8a44995bc0e0”,  
“app”,  
“2015-12-29”  
]  
],  
[  
[  
“71dbcb06-e807-4316-9257-722c6ccf8031”,  
“web”,  
“2015-12-29”  
]  
]  
]  
}

I and want to do loop and search only for “app” and create list of hashes with this structure stored in one variable (for example jkl22)

{  
“created”: “2015-12-29”,  
“name”: “app”,  
“id”: “e0c9cf47-00f2-4909-84a5-d3db7cbf61f3”

},  
{

“created”: “2015-12-29”,  
“name”: “app”,  
“id”: “0b3d86bb-8acb-4d27-8d51-8a44995bc0e0”

}

I tried to do this by:

- set\_fact:  
jkl22: “{{ jkl22|default({})|combine({‘created’: item.2, ‘name’: item.1, ‘id’: item.0}) }}”  
with\_items: jkl11  
when: item.1 == “app”

But i got only the last one.:

debug msg={{ jkl22 }}] \*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“changed”: false,  
“msg”: {  
“created”: “2015-12-29”,  
“name”: “app”,  
“id”: “0b3d86bb-8acb-4d27-8d51-8a44995bc0e0”  
}  
}

How can i do this?

Regards,  
Gerhard
