New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The order of the hosts in a group_by updated group is not guaranteed to be the same between runs #16933
Comments
@srvg per our irc convo, would be nice to have a simple reproducer to demonstrate the issue. |
See https://gist.github.com/srvg/bbc05198f033337cbb4b599c13839092 for a full example. |
@srgvg Repoducer no longer exists :( |
We are considering using |
@gundalow Sorry, I changed my github username a while ago! Reproducer: https://gist.github.com/srgvg/bbc05198f033337cbb4b599c13839092 |
I am also experiencing this issue. Random changing the order of groups and serial plays later on running out of order. Is there any solution other than running my group_by add play in serial as well (this greatly increase my runtime and I would like to avoid it). I think I found another work around which doesn't involve running an entire play as serial:1 -group_by add install install group: |
probably fixed via #58000, please confirm long explanation: python 'mapping order' is inconsistent across runs/versions of Python, it depends on the hashing done, the PR above forces to always uses 'ordered dictionaries' , which is also the default in newer versions of Python (language in which Ansible is written). |
Thanks @bcoca I'll try and upgrade the Ansible version I'm running asap. |
Just FYI @bcoca It seems like my work around works. |
it was already merged, will be in released in 2.10, so I'm closing this issue as resolved. |
ISSUE TYPE
COMPONENT NAME
core
ANSIBLE VERSION
SUMMARY
The order of the hosts in a group_by updated group is not guaranteed to be the same between runs.
Adding a serial: 1 in the play where group_by is done seems to be a workaround
STEPS TO REPRODUCE
Just do a group_by, and do repeated runs, and debug check the order of the nodes in the created/updated group.
Running from a pure hosts based inventory or from a dirctory based inventory might trigger a difference sooner.
EXPECTED RESULTS
The same order at every run, alfanumerically, in the same order as the hosts were already in other groups.
ACTUAL RESULTS
Sometimes a reversed order.
The text was updated successfully, but these errors were encountered: