Several recent issues have been posted concerning changed behavior between Ansible 1.9 and 2.0 (beta)
for host and host variables mentioned among multiple nested inventories
(i.e. static and dynamic inventories under the same inventory directory).
-
Host variables are not merged appropriately when using inventory directories #13431
-
host_vars not merged between multiple host files #13397 (closed and reopened)
-
2.0 not reading vars for host in multiple inventory sources #13187 (closed as duplicate of #13397)
I’ve created a few integration tests for the interaction of hosts defined by multiple inventories
and a few of these continue to fail.
I think a part of the problem is that I don’t think the behavior is defined when a host is mentioned
by more than one inventory source. Unless is its just defined by “whatever 1.9 does”.
Issue #13187 indicates that a ansible-devel thread should be started to discuss and unresolved problems,
so this is another appeal to the core team to define the behavior for the same host
mentioned explicitly in more than one inventory.
Which of these apply?
-
Host variables defined in different inventories will be merged according to {{ some precedence rules }}.
-
Host variables defined in different inventories will be merged with conflicts resulting in an {{ error , warning, undefined manner }}.
-
Hosts may be mentioned in multiple inventories, but may have variables defined in at most one inventory
-
Hosts must not be mentioned explicitly in multiple inventories, however the groups they belong to may.
-
The ansible configuration hash_behaviour applies to inventory host variables {{ not at all, in some particluar way }}
-
Dynamic Groups may be children of Static Groups.
Thanks