Repository navigation
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: fooOutput: |
|
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. |
mkrizek
left a comment
There was a problem hiding this comment.
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_duplicateswas never implemented for eitherinclude_roleor 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