Adds user-selectable hash merging support in vars

Hash variables are currently overriden if they are redefined. This
doesn't let the user refine hash entries or overriding selected keys,
which can, for some, be a desirable feature.
This patch let the user force hash merging by setting the
hash_behaviour value to "merge" (without the quotes) in ansible.cfg

However, by default, ansible behaves like it always did and if any value
besides "merge" is used ("replace" is suggested in the example ansible.cfg
file), it will also behave as always.
This commit is contained in:
Michel Blanc 2013-01-23 21:39:34 +01:00
commit e28e538c6e
4 changed files with 45 additions and 3 deletions

View file

@ -76,6 +76,16 @@ remote_port=22
sudo_exe=sudo
# how to handle hash defined in several places
# hash can be merged, or replaced
# if you use replace, and have multiple hashes named 'x', the last defined
# will override the previously defined one
# if you use merge here, hash will cumulate their keys, but keys will still
# override each other
# replace is the default value, and is how ansible always handled hash variables
#
# hash_behaviour=replace
# if set, always use this private key file for authentication, same as if passing
# --private-key to ansible or ansible-playbook