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 }}”