# issue with with\_items

**URL:** <https://forum.ansible.com/t/issue-with-with-items/19309>\
**Category:** Ansible Project\
**Created:** [September 20, 2015, 2:09pm UTC](https://forum.ansible.com/t/issue-with-with-items/19309 "2015-09-20T14:09:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wanna\_know](https://avatars.discourse-cdn.com/v4/letter/w/a587f6/32.png) [@wanna\_know](https://forum.ansible.com/u/wanna_know)\
**Post date:** [September 20, 2015, 2:09pm UTC](https://forum.ansible.com/t/issue-with-with-items/19309/1 "2015-09-20T14:09:46Z")

</div>

hi all,

i’m new to ansible… i 'm having issues with looping with this set of data with with\_items

ok: [host1] =\> {“ansible\_facts”: {“foo”: “[u’app1 app2’, u’app1,app2’]”}}

ok: [host2] =\> {“ansible\_facts”: {“foo”: “[u’app1 app2’, u’app1 app2’]”}}

ok: [host3] =\> {“ansible\_facts”: {“foo”: “[u’app1 app2’]”}}

ok: [host4] =\> {“ansible\_facts”: {“foo”: “[u’app1 app2’]”}}

- name: make a list  
set\_fact: foo=“{{ foo\_result.results | map(attribute=‘ansible\_facts.foo\_item’) | list }}”

# - debug: var=foo

- name: test list with k v  
shell: echo {{ item.apphome }} \> /tmp/{{inventory\_hostname}}\_var.txt;cmd {{ item }} \> /tmp/{{inventory\_hostname}}\_result.txt  
with\_items:
- “{{ foo\_item }}”

# - debug: var=foo\_item
