-
Notifications
You must be signed in to change notification settings - Fork 624
attempt to correct docs on role deduplication #1123
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,7 +156,7 @@ When using ``vars:`` within the ``roles:`` section of a playbook, the variables | |
Including roles: dynamic reuse | ||
------------------------------ | ||
|
||
You can reuse roles dynamically anywhere in the ``tasks`` section of a play using ``include_role``. While roles added in a ``roles`` section run before any other tasks in a play, included roles run in the order they are defined. If there are other tasks before an ``include_role`` task, the other tasks will run first. | ||
You can reuse roles dynamically anywhere in the ``tasks`` section of a play using ``include_role``. While roles added in a ``roles`` section run before any other tasks in a play, included roles run in the order they are defined. If there are other tasks before an ``include_role`` task, the other tasks will run first. Ansible does not deduplicate included roles, even if they have the exact same parameters, and setting ``allow_duplicates: false`` has no effect on ``include_role``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does but it is a bit limited, it includes the vars context for the 'signature' to dedupe on, which makes it very hard for the |
||
|
||
To include a role: | ||
|
||
|
@@ -246,6 +246,8 @@ You can pass other keywords, including variables and tags when importing roles: | |
|
||
When you add a tag to an ``import_role`` statement, Ansible applies the tag to `all` tasks within the role. See :ref:`tag_inheritance` for details. | ||
|
||
Ansible does not deduplicate imported roles, even if they have the exact same parameters, and setting ``allow_duplicates: false`` has no effect on ``import_role``. | ||
|
||
.. _role_argument_spec: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment above, it should dedupe now in most cases |
||
|
||
Role argument validation | ||
|
@@ -490,7 +492,7 @@ Ansible only executes each role once in a play, even if you define it multiple t | |
- bar | ||
- foo | ||
|
||
You have two options to force Ansible to run a role more than once. | ||
You have three options to force Ansible to run a role more than once. | ||
|
||
Passing different parameters | ||
---------------------------- | ||
|
@@ -521,6 +523,11 @@ This syntax also runs the ``foo`` role twice; | |
|
||
In these examples, Ansible runs ``foo`` twice because each role definition has different parameters. | ||
|
||
Using ``include_role`` or ``import_role`` | ||
----------------------------------------- | ||
|
||
Ansible does not deduplicate imported or included roles. When you use ``include_role`` or ``import_role``, Ansible runs each role, as long as any conditions on those tasks are met. This is true even if the parameters are the same on multiple included or imported roles. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they have a |
||
Using ``allow_duplicates: true`` | ||
-------------------------------- | ||
|
||
|
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.
The behavior on devel, which I believe is correct, runs 5 of the 8 role invocations, deduplicating the other 3, for this playbook: