-
Notifications
You must be signed in to change notification settings - Fork 145
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
Playbook fails due to roles using ansible-galaxy command #730
Comments
Perhaps it could be considered that the user could define before use which collection to use to avoid this auto-detection and only in case not specified the role would fall-back to this current approach. |
Most of times, it has no sense having more than one
You can work consistently running the following commands (
That way, you'll get the same collections both from
Does this makes sense for you @myllynen? |
Thanks for looking into this. I think the cleanest approach to solve this with the current code would be to simply use the However, I wonder would it make sense to provide a configuration option for the role to allow defining whether to use But of course the most important thing would be to avoid the issue mentioned in #741 as that now prevents using the role in altogether with recent Ansible versions, perhaps the eventual fix for that could take this issue to consideration as well. Thanks. |
Both
filetree_create
andobject_diff
do this:Ideally dependencies would be defined and thus automatically solved by defining them in the collection's
galaxy.yml
but here the intention seems to be supporting using eitheransible.controller
orawx.awx
.This causes problems when using a custom
ansible.cfg
which configures Ansible home or collections directory, think of for example fully isolated CI/CD runs or any kind of development/execution setup using non-default directories.If a playbook using these roles is in a different directory than
ansible.cfg
, say, there is./ansible.cfg
and./playbooks/test.yml
, then runningansible-playbook ./playbooks/test.yml
fails since theansible-galaxy
command invoked by the role runs in theplaybooks
dir, not in the current working directory whereansible-playbook
is run and whereansible.cfg
is located, and then fails to detect that a required collection is in fact already installed. This can also be confusing for the user whenansible-galaxy collection list
shows the collection installed but the role complains the role not being installed.Moving playbooks to the same directory would solve the issue but with repositories with lots of content keeping playbooks in a dedicated directory is helpful.
The text was updated successfully, but these errors were encountered: