role argspec - tag role argspec validation task with 'always' (#74994)
* update tag docs
This commit is contained in:
parent
d2d45900ed
commit
97acb0f470
2
changelogs/fragments/role_argspec_tagged_always.yml
Normal file
2
changelogs/fragments/role_argspec_tagged_always.yml
Normal file
|
@ -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
|
you apply a tag and then use a different tag in ``--tags`` or the same
|
||||||
tag in ``--skip-tags``.
|
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
|
.. 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``).
|
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,
|
'name': task_name,
|
||||||
|
'tags': ['always'],
|
||||||
}
|
}
|
||||||
|
|
||||||
def _load_role_yaml(self, subdir, main=None, allow_dir=False):
|
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 "$@"
|
ansible-playbook test_play_level_role_fails.yml -i ../../inventory "$@"
|
||||||
test $? -ne 0
|
test $? -ne 0
|
||||||
set -e
|
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."
|
||||||
|
|
11
test/integration/targets/roles_arg_spec/test_tags.yml
Normal file
11
test/integration/targets/roles_arg_spec/test_tags.yml
Normal 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
|
Loading…
Reference in a new issue