It would be nicer to have a filter for jinja2, but this works:

defaults.yml
d1: 
  k1: 1

d2:
  k1: 2
  k2: 3

tasks/main.yml
- name: dbg
  debug: msg="{{d1}}     {{d2}}"

- set_fact:
     d1: "{% do d1.update(d2) %}{{d1}}"

- debug: msg="{{d1['k1']}}"

OUTPUT

TASK: [gnf_data | dbg] 
******************************************************** 
<deploy-test-1> ESTABLISH CONNECTION FOR USER: ubuntu
ok: [deploy-test-1] => {
    "msg": "{'k1': 1}     {'k2': 3, 'k1': 2}"
}

TASK: [gnf_data | set_fact ] 
************************************************** 
<deploy-test-1> ESTABLISH CONNECTION FOR USER: ubuntu
ok: [deploy-test-1] => {"ansible_facts": {"d1": {"k1": 2, "k2": 3}}}

TASK: [gnf_data | debug msg="{{d1['k1']}}"] 
*********************************** 
<deploy-test-1> ESTABLISH CONNECTION FOR USER: ubuntu
ok: [deploy-test-1] => {
    "msg": "2"
}



On Tuesday, October 28, 2014 10:36:20 PM UTC-5, Brian Coca wrote:
>
> I could swear I had patched the union filter to use update when dicts were 
> passed in, let me try this again.
>
> Brian Coca
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0b8a5604-5dc5-4a66-98d8-56ac2ad54527%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to