While searching for my use-case, I stumbled upon this issue https://github.com/ansible/ansible/issues/73208 when the explanation provided was “The group_names variable is purposefully alphanumerically sorted by name, and not sorted by definition order.” However, this explanation doesn’t tell me for what purpose (in my mind, I could sort the list if I needed it that way), while I would benefit of having it sorted depending on the level. Nevertheless, is there a workaround to get the list of groups on which you can rely, level-wise ?
https://github.com/ansible/ansible/issues/73208 when the explanation
provided was "The group_names variable is purposefully alphanumerically
sorted by name, and not sorted by definition order." ... get the list
of groups on which you can rely, level-wise ?
Use *ansible-inventory* and parse the inventory on your own. Given
the example from the issue