Ok, I would file a ticket on this one, I think the include_vars just needs
to call our usual combine_vars function.

Thanks!

--Michael



On Tue, Sep 23, 2014 at 8:46 AM, Daniel Schroeder <[email protected]>
wrote:

> I'm running the most recent version available via homebrew, 1.7.1
>
> Am Dienstag, 23. September 2014 14:20:52 UTC+2 schrieb Michael DeHaan:
>>
>> For starters, can you please share what version of Ansible you are using?
>>
>>
>> (It very well could be that include_vars isn't aware of hash merging, as
>> it was a more recent addition and hash merging is used most frequently with
>> different groups of inventory and such - I am not sure it makes sense here
>> - but it may)
>>
>> Thanks!
>>
>>
>>
>> On Tue, Sep 23, 2014 at 7:12 AM, Daniel Schroeder <[email protected]
>> > wrote:
>>
>>> Hello,
>>>
>>> I want to merge hashes of config files. My *ansible.cfg* includes this
>>> line:
>>>
>>> hash_behaviour = merge
>>>
>>> The *ansible.cfg* file is in the same directory as my playbook, in
>>> other words, the current directly where I'm cd'ed in when running
>>> *ansible-playbook*. I confirmed it's being used by adding a syntax
>>> error which ansible then complains about. *ANSIBLE_CONFIG* is empty so
>>> it should be the first and last to check.
>>>
>>> But my hash is not merged, but overridden.
>>>
>>> In my example I have 3 tasks:
>>>
>>> - include_vars: /path/to/file/A
>>>
>>> - include_vars: /path/to/file/B
>>>
>>> - debug: var=test
>>>
>>>
>>> Content of file A:
>>> test:
>>>   a: 1
>>>
>>> Content of file B:
>>> test:
>>>   b: 1
>>>
>>> When I run my playbook, this is the result:
>>>
>>> TASK: [include_vars /path/to/file/A] ***
>>> ok: [test1.local]
>>>
>>>
>>> TASK: [include_vars /path/to/file/B] ***
>>> ok: [test1.local]
>>>
>>>
>>> TASK: [debug var=test] ******************************************
>>> ok: [test1.local] => {
>>>     "test": {
>>>         "b": 1
>>>     }
>>> }
>>>
>>> Is this expected? How can I archive that the hash is merged and the
>>> resulting value is
>>>
>>> test: {
>>>   "a": 1,
>>>   "b": 1
>>> }
>>>
>>>
>>> Thanks,
>>> Daniel
>>>
>>> --
>>> 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/f08ac158-ca36-4164-9d13-
>>> ddacc7e0abd4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/f08ac158-ca36-4164-9d13-ddacc7e0abd4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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/db39398a-0590-4462-94aa-dc2a6456a54e%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/db39398a-0590-4462-94aa-dc2a6456a54e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgyKSWvdRY05fpwuRvEXH6nE4oKGk73m6hzP%3DA0J9Ww9mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to