-
Feature Request
-
Resolution: Unresolved
-
Normal
-
None
-
2.4
-
False
-
-
False
Ansible-core runs hosts in the order they are in the inventory file allowing the use of positional notations like:
fileserver:
hosts:
wpv-fs1: {}
wpv-fs2: {}
wpv-fs3: {}
You would then be able to target the first host in the group like this:
when: "groups.fileserver is defined and ansible_hostname == groups.fileserver.0"
this is no longer guaranteed to work in AAP:
"the ‘inventory’ order does not equate to the order in which hosts/groups are defined in the inventory source file, but the ‘order in which a selection is returned from the compiled inventory’. This is a backwards compatible option and while reproducible it is not normally predictable. Due to the nature of inventory, host patterns, limits, inventory plugins and the ability to allow multiple sources, it is almost impossible to return such an order. For simple cases, this might happen to match the file definition order, but that is not guaranteed."
We would like this to be changed so that order in the inventory and order of execution remains constant.