summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shrewsbury <Shrews@users.noreply.github.com>2021-02-19 00:16:03 +0100
committerGitHub <noreply@github.com>2021-02-19 00:16:03 +0100
commitc8ee186e11bfdf8a3e17c0a6226caaf587fa2e89 (patch)
tree53aa5590f1af639986fed341078c051f921dd9aa
parentReplace reference to playbook_environment (#73633) (diff)
downloadansible-c8ee186e11bfdf8a3e17c0a6226caaf587fa2e89.tar.xz
ansible-c8ee186e11bfdf8a3e17c0a6226caaf587fa2e89.zip
Remove warning about role validation with deps (#73653)
* Remove warning about role validation with deps * add changelog * update cl
-rw-r--r--changelogs/fragments/73653-rolespec-rm-warning.yml2
-rw-r--r--docs/docsite/rst/user_guide/playbooks_reuse_roles.rst6
-rw-r--r--lib/ansible/playbook/role/__init__.py5
3 files changed, 8 insertions, 5 deletions
diff --git a/changelogs/fragments/73653-rolespec-rm-warning.yml b/changelogs/fragments/73653-rolespec-rm-warning.yml
new file mode 100644
index 0000000000..c3adfc8f7c
--- /dev/null
+++ b/changelogs/fragments/73653-rolespec-rm-warning.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - Remove the warning displayed when validating the arg spec of a role with dependencies and add it to the documentation.
diff --git a/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst b/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst
index 80ef24e6e0..91a0f66a90 100644
--- a/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst
+++ b/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst
@@ -264,6 +264,12 @@ specification defined in the role ``meta/main.yml`` file. When this argument spe
a new task is inserted at the beginning of role execution that will validate the parameters supplied
for the role against the specification. If the parameters fail validation, the role will fail execution.
+.. note::
+
+ When role argument validation is used on a role that has defined :ref:`dependencies <role_dependencies>`,
+ then validation on those dependencies will run before the dependent role, even if argument validation fails
+ for the dependent role.
+
Specification Format
--------------------
diff --git a/lib/ansible/playbook/role/__init__.py b/lib/ansible/playbook/role/__init__.py
index 448d2a9803..267005ee92 100644
--- a/lib/ansible/playbook/role/__init__.py
+++ b/lib/ansible/playbook/role/__init__.py
@@ -34,10 +34,8 @@ from ansible.playbook.role.metadata import RoleMetadata
from ansible.playbook.taggable import Taggable
from ansible.plugins.loader import add_all_plugin_dirs
from ansible.utils.collection_loader import AnsibleCollectionConfig
-from ansible.utils.display import Display
from ansible.utils.vars import combine_vars
-display = Display()
__all__ = ['Role', 'hash_params']
@@ -288,9 +286,6 @@ class Role(Base, Conditional, Taggable, CollectionSearch):
:returns: The (possibly modified) task list.
'''
if self._metadata.argument_specs:
- if self._dependencies:
- display.warning("Dependent roles will run before roles with argument specs even if validation fails.")
-
# Determine the role entry point so we can retrieve the correct argument spec.
# This comes from the `tasks_from` value to include_role or import_role.
entrypoint = self._from_files.get('tasks', 'main')