You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Hello list,
I have encountered some not expected results when i tried to include (with include_vars) multiple var files in the beginning of a play.
I normally use the "merge" hash behavior (ansible.cfg) because it seems more natural to me: i usually have highly nested variable dicts and i wish to add or override just parts of them based on the group/host hierarchy.
Now, i tried to include some variables in the beginning of a play (at "pre_tasks" phase, but i don't thing it's relevant), to override some parts of existing dicts with piece of information regarding other present hosts (e.g. IPs for standby servers). It didn't succeed.
Consider the following example:
``` # vars file: play_vars/baz-a.yml baz: a: 1 ```
``` # vars file: play_vars/baz-b.yml baz: b: 2 ```
When playing play.yml, i get: "baz": {"b": 2} while expecting "baz": {"a":1, "b":2}. Is this normal? Note, this is happening under hash_behavior=merge.
Michail Alexakis
unread,
May 12, 2015, 1:56:52 PM5/12/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Hello,
any answer to this question?
Adam Hamsik
unread,
May 13, 2015, 12:41:11 PM5/13/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Have a look at hash_behaviour in ansible.cfg and set it to merge. But be aware that it's usually sign of bad design.
Michail Alexakis
unread,
May 13, 2015, 1:35:07 PM5/13/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Hello Adam,
I allready have set it to "merge", actually that's the reason i posted this question (because it doesn't seem to merge). Have you tried the example above? I tested it under ansible==1.8.4. Maybe i am missing something obvious.
Brian Coca
unread,
May 13, 2015, 1:41:33 PM5/13/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
there was a but in 1.8 with hash_merge, have you tried in 1.9?
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Hello Brian,
I just tested the above with a freshly installed ansible==1.9.1, and the problem seems to be still here. I played the example posted above accompanied with a simple ansible.cfg: ``` [defaults] hash_behaviour = merge ```
Cant you reproduce it?
Brian Coca
unread,
May 13, 2015, 3:22:47 PM5/13/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
So I looked and include_vars works by returning ansible_facts which
bypasses, on purpose, hash merging as facts should overwrite
themselves. The way this currently CAN work ... its not clear how we
can use the merge,I'll add notes to the docs that include_vars always
overwrites.
--
Brian Coca
Michail Alexakis
unread,
May 13, 2015, 3:40:57 PM5/13/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Ok, i understand, seems that include_vars works like set_fact in this place.