Below is my playbook that loads and prints the variables --- - name: Demonstrating variables in Jinja2 Loops hosts: localhost
- name: Load variable files include_vars: file="{{ playbook_dir }}/vars/vars.yml" - debug: msg: "COUNTRY {{ item.countries | join('') }} has IP ADDRESS {{ item.1 | join('') }} which has DISKs {{ item.1.disks | join('') }}" with_subelements: - "{{ regions }}" - countries.ALL_IPS I wish to print like below for all the entries in the vars.yml COUNTRY CORE DUBAI has IP ADDRESS 10.0.0.1 which has DISKS /fins and /tmp COUNTRY CORE DUBAI has IP ADDRESS 10.0.0.4 has DISKS /was COUNTRY CORE SINGAPORE has IP ADDRESS 10.0.1.5 which has DISKS /fins and / tmp Below is my vars/vars.yml which is designed and works fine with my jinja2 template where i am able to fetch all value i need from vars.yml --- regions: - name: PROD countries: - CORE DUBAI: name: CORE DUBAI ALL_IPS: - 10.0.0.1: name: 10.0.0.1 disks: - /fins - /tmp - 10.0.0.4: name: 10.0.0.4 disks: - /was - CORE SINGAPORE: name: CORE SINGAPORE ALL_IPS: - 10.0.1.5: name: 10.0.1.5 disks: - /fins - /tmp I get the below error while running my playbook: TASK [debug] ************************************************************************************************************************************************ fatal: [localhost]: FAILED! => {"msg": "the key countries should point to a dictionary, got '[{u'ALL_IPS': [{u'disks': [u'/fins', u'/tmp'], u'10.0.0.1': None, u'name': u'10.0.0.1'}, {u'10.0.0.4': None, u'disks': [u'/was'], u'name': u'10.0.0.4'}], u'name': u'fins CORE DUBAI', u'fins CORE DUBAI': None}, {u'ALL_IPS': [{u'disks': [u'/fins', u'/tmp'], u'name': u'10.0.1.5', u'10.0.1.5': None}, {u'10.0.0.4': None, u'disks': [u'/was'], u'name': u'10.0.0.4'}], u'fins CORE SINGAPORE': None, u'name': u'fins CORE SINGAPORE'}]'"} PLAY RECAP ************************************************************************************************************************************************** localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 Can you please suggest how can i get the desired output ? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/483757b2-967b-435d-a24f-afd97c8ecc47%40googlegroups.com.