allow users to control group var merge order (#22580)

* allow users to control group var merge order

With ansible_group_priority var at each group will determine merge order with siblings,
falling back to sorted names when priority is equal as it did before.

Parent/children relationships still work as they did and have higher precedence than priority

* move priority setting to groups, sourc indep

* now both inventory and play group follow priority

* removed double exception handling
This commit is contained in:
Brian Coca 2017-03-16 14:02:43 -04:00 committed by GitHub
parent 5334814396
commit 4319ddd5de
5 changed files with 9 additions and 11 deletions

View file

@ -160,10 +160,7 @@ class InventoryParser(object):
# applied to the current group.
elif state == 'vars':
(k, v) = self._parse_variable_definition(line)
if k != 'ansible_group_priority':
self.groups[groupname].set_variable(k, v)
else:
self.groups[groupname].set_priority(v)
self.groups[groupname].set_variable(k, v)
# [groupname:children] contains subgroup names that must be
# added as children of the current group. The subgroup names