-
Notifications
You must be signed in to change notification settings - Fork 24k
remove 'allow_duplicates' param for include/import role #82677
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
base: devel
Are you sure you want to change the base?
Conversation
There appears to be some confusion in the original issue between static imports of a role using This parameter is and has been implemented for It also appears that despite what was stated in replies to the bug, it currently has an effect for Test playbook: - hosts: localhost
name: import_role with no allowed duplicates
gather_facts: false
tasks:
- import_role:
name: foo
allow_duplicates: false
- import_role:
name: foo
allow_duplicates: false
- hosts: localhost
name: import_role with allowed duplicates
gather_facts: false
tasks:
- import_role:
name: foo
- import_role:
name: foo
- hosts: localhost
name: include_role with no allowed duplicates
gather_facts: false
tasks:
- include_role:
name: foo
allow_duplicates: false
- include_role:
name: foo
allow_duplicates: false
- hosts: localhost
name: include_role with allowed duplicates
gather_facts: false
tasks:
- include_role:
name: foo
- include_role:
name: foo Output:
|
Oh, and another permutation, which also appears to behave the way the current documentation would suggest: - hosts: localhost
name: mixed usage with no allowed duplicates
gather_facts: false
tasks:
- import_role:
name: foo
allow_duplicates: false
- include_role:
name: foo
allow_duplicates: false
- import_role:
name: foo
allow_duplicates: false
- include_role:
name: foo
allow_duplicates: false
|
I bisected to see when this started, and it looks like a side effect of a templating bug I fixed #80320. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears allow_duplicates
works for both include_role
and import_role
. I suppose we should make sure we have tests for both cases. We should probably also add version_added
to the documentation too?
Oh, excellent - so it's possible to set |
SUMMARY
Part of correcting the documentation about how to deduplicate roles. I've read several issues, many of them closed. I believe that
allow_duplicates
was never implemented for eitherinclude_role
or forimport_role
, and that Ansible currently runs the same role multiple times if a play imports or includes it more than once. This PR removes the parameter from the module documentation for those two modules. A companion PR in ansible-documentation updates the pages on reusing roles to match.If this isn't correct, I'm happy to change the PR to reflect whatever the current actual behavior of Ansible is.
Related to ansible/ansible-documentation#90.
ISSUE TYPE
ADDITIONAL INFORMATION
N/A