-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Roles can't use collection modules when collections are listed at playbook level #68198
Comments
Files identified in the description:
If these files are inaccurate, please update the |
Before someone tells me that I should start writing out the Fully Qualified Collection Name (FQCN) on each and every task I write in all my Ansible playbooks... no. I'm writing YAML, not Java! The |
This is expected, please see #66667 |
Can we reopen if we don't agree this is useful and/or expected behavior? Or alternatively, can we just drop the Having both coexist == hell once 2.10 is released and people try updating playbooks. [Edit: Note—I'm a strong proponent of the former, this is far beyond attacking my ability to use hyphens in group names in terms of 'makes Ansible annoying to use'.] |
There are no plans to change this behavior. |
In that PR's description:
Why can't a role fall back on the calling playbook's settings? As it is, this is going to make my use of roles a lot more painful. I get adding collections to a role like my But I use individual roles in single playbooks a lot, and because of this change with collections, I'll have to add All I'm wondering is why roles can't fall back to the play's |
I'm experiencing the same issue like @geerlingguy in the case of using roles in playbooks as a way to structure playbooks more clearly. Given the current state of this feature such a setup doesn't reduce the amount of work, instead the work required scales up with the number of roles being factored out. From a user's perspective I'd like roles to be able to "bring" their own required collections as well as be able to "live" in the playbooks environment using the collections from that setup. |
I'm going to keep campaigning for this—using roles without this functionality is incredibly annoying, and yes I know there are workarounds; they all require a new level of verbosity and rework, when my playbooks do not require this. Additionally, assuming you use Ansible Community Distribution (ACD), which will continue to ship and supposedly work without specifying This leads to playbooks which will work fine in ACD, but break with any other distribution of Ansible. |
One difficulty, I think, is that the term "role"/"roles" can mean a lot of different things depending on context, and some of the usages aren't accounted for in the current plans/migration paths:
It's |
To keep thoughts collected in one place, geerlingguy/ansible-content-testing#4 (comment) |
SUMMARY
If I put a task from my playbook which uses a module defined in a collection into a role, it breaks the playbook.
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
macOS Catalina
STEPS TO REPRODUCE
main.yml
contents:test_role/tasks/main.yml
contents:EXPECTED RESULTS
The playbook should run. The
k8s_log
task should work the same in the roletasks/main.yml
file as it does in the rest of the playbook.ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: