Is it possible to make available multiple collection versions in the same EE?
XY:
We want to allow pinning different collection versions (a specific role in a specific collection) to different hosts in a large inventory orchestrated by AWX.
Serializing the deployment, to override the ansible galaxy context during runtime, makes it very slow.
Additionally, managing a large fleet of EE (permutation of hosts and collection versions) is expensive.
Lastly, we’ve split up some 50 roles into a few collections in a monorepo whose CI published to a private Ansible Galaxy repository.
Let’s say across environments (staging, production) but even during a rolling update; Cluster of type x with y nodes where we want to apply a newer collection[.role] version for y/z nodes at a time.
Right now, we’ve implemented this capability by dynamically including roles during runtime. The collection and version is supplied as a variable. To allow “multiple” collection versions we publish each collection version with a new name; A name that includes the collection version.
e.g.
namespace.collection_major_minor_patch
This way, the same EE can handle multiple versions. As, in the context of ansible-galaxy, they are different.
We can pin a collection versions to any subset of hosts.
But, we aren’t sure this is the best approach.
It feels like an antipattern.
Hi,
It’s a kind of workaround and probably something you have constraints with but why don’t you create roles with requirements.yml that specify collection version ?
In that case, you probably dynamically install the version you wants depends on the role you call (that depends on your need , there’s a lot of “depends on”)