role argspec - tag role argspec validation task with 'always' (#74994) (#74996)

* update tag docs

(cherry picked from commit 97acb0f470)
pull/75001/head
David Shrewsbury 3 years ago committed by GitHub
parent dce10b89ad
commit f752c7f179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- roles - make sure argspec validation task is tagged with ``always`` (https://github.com/ansible/ansible/pull/74994).

@ -305,6 +305,10 @@ For example:
you apply a tag and then use a different tag in ``--tags`` or the same
tag in ``--skip-tags``.
.. warning::
* The role argument specification validation task is tagged with 'always' by default. This validation
will be skipped if you use ``--skip-tags always``.
.. versionadded:: 2.5
If you assign the ``never`` tag to a task or play, Ansible will skip that task or play unless you specifically request it (``--tags never``).

@ -358,6 +358,7 @@ class Role(Base, Conditional, Taggable, CollectionSearch):
},
},
'name': task_name,
'tags': ['always'],
}
def _load_role_yaml(self, subdir, main=None, allow_dir=False):

@ -25,3 +25,8 @@ set +e
ansible-playbook test_play_level_role_fails.yml -i ../../inventory "$@"
test $? -ne 0
set -e
# Test the validation task is tagged with 'always' by specifying an unused tag.
# The task is tagged with 'foo' but we use 'bar' in the call below and expect
# the validation task to run anyway since it is tagged 'always'.
ansible-playbook test_tags.yml -i ../../inventory "$@" --tags bar | grep "a : Validating arguments against arg spec 'main' - Main entry point for role A."

@ -0,0 +1,11 @@
---
- hosts: localhost
gather_facts: false
tasks:
- name: "Tag test #1"
import_role:
name: a
vars:
a_str: "tag test #1"
tags:
- foo
Loading…
Cancel
Save