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

* update tag docs
This commit is contained in:
David Shrewsbury 2021-06-14 13:28:56 -04:00 committed by GitHub
parent d2d45900ed
commit 97acb0f470
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 0 deletions

View file

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

View file

@ -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``).

View file

@ -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):

View file

@ -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."

View file

@ -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