Include dependency role names in role_names. (#46483)

* -Change: Include dependency role names in `role_names`.
-Add: `play_role_names` magic variable to include only explicitly named roles (formerly `role_names`).
-Add: `dependent_role_names` magic variable to include all dependency names for all roles.

* -Change: use the ansible_ prefix for new magic variables.
-Change: keep `role_names` as a deprecated variable, using the old functionality.

* -Add: changelog fragment for the role_names rework.

* -Add: Tests for the role_names (and ansible_*role_names) special variables

* -Fix: resolve erroneous documentation snippet that was introduced after rebasing.

* -Fix: explicitly sort to ensure list comparison works in test.
This commit is contained in:
Xaroth
2018-11-15 16:01:29 +01:00
committed by Brian Coca
parent 90d17924a4
commit 87d10b9b78
5 changed files with 65 additions and 3 deletions

View File

@@ -0,0 +1,11 @@
minor_changes:
- magic variables - added a new ``ansible_role_names`` magic variable to include the names of roles being applied to
the host both directly and indirectly (via dependencies).
- magic variabels - added a new ``ansible_play_role_names`` magic variable to mimic the old functionality of
``role_names``. This variable only lists the names of roles being applied to the host directly, and does not
include those added via dependencies
- magic variables - added a new ``ansible_dependent_role_names`` magic variable to contain the names of roles
applied to the host indirectly, via dependencies.
deprecated_features:
- magic variables - documented the deprecation of the ``role_names`` magic variable in favor of either
``ansible_role_names`` (including dependency role names) or ``ansible_play_role_names`` (excluding dependencies).