issue with with_items

16 views
Skip to first unread message

wanna know

unread,
Sep 21, 2015, 8:36:34 AM9/21/15
to Ansible Project
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

Reply all
Reply to author
Forward
0 new messages