> > - name: Jinja Example Playbook > hosts: localhost > connection: local > vars_files: > - test-role/defaults/container.yml > - test-role/defaults/container_env.yml > vars: > combined_containers: "{{ (containers + container_env) | unique}}" > > tasks: > - name: Container file > debug: > msg: "{{containers}}" > - name: Container env file > debug: > msg: "{{container_env}}" > - name: Combined > debug: > msg: "{{combined_containers}}" > - debug: > msg: "{{item.name}} - {{item.version}} - {{item.env}}" > with_items: > - "{{combined_containers}}" >
--- > container_env: > - name: httpd > env: Phil > - name: httpd > env: Phil > --- containers: - name: httpd version: 2.4 - name: httpd env: Phil PLAY [Jinja Example Playbook] ************************************************** TASK [setup] ******************************************************************* ok: [localhost] TASK [Container file] ********************************************************** ok: [localhost] => { "msg": [ { "name": "httpd", "version": 2.4 }, { "env": "Phil", "name": "httpd" } ] } TASK [Container env file] ****************************************************** ok: [localhost] => { "msg": [ { "env": "Phil", "name": "httpd" }, { "env": "Phil", "name": "httpd" } ] } TASK [Combined] **************************************************************** ok: [localhost] => { "msg": [ { "name": "httpd", "version": 2.4 }, { "env": "Phil", "name": "httpd" } ] } TASK [debug] ******************************************************************* fatal: [localhost]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'env'"} I am expecting to receive a combined list like this. What can I do to accomplish that? "msg": [ { "name": "httpd", "version": 2.4, "env": "Phil" } ] -- *The information contained in this transmission (including any attachments) is confidential and may be privileged. It is intended only for the use of the individual or entity named above. If you are not the intended recipient, dissemination, distribution, or copy of this communication is strictly prohibited. If you have received this communication in error, please erase all copies of this message and its attachments and notify me immediately.* -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5778179a-3324-4ce0-bac3-d4496e72a685%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.