From 7a312b6cf775a48e3ed2a69b12f94ff4131a0004 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 21 Sep 2017 16:23:16 -0400 Subject: [PATCH] add ability to set default tags in config --- lib/ansible/cli/__init__.py | 4 ++-- lib/ansible/config/base.yml | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/ansible/cli/__init__.py b/lib/ansible/cli/__init__.py index 4e1bd23aa06..82b52f5df3d 100644 --- a/lib/ansible/cli/__init__.py +++ b/lib/ansible/cli/__init__.py @@ -453,9 +453,9 @@ class CLI(with_metaclass(ABCMeta, object)): help='the new vault identity to use for rekey') if subset_opts: - parser.add_option('-t', '--tags', dest='tags', default=[], action='append', + parser.add_option('-t', '--tags', dest='tags', default=C.TAGS_RUN, action='append', help="only run plays and tasks tagged with these values") - parser.add_option('--skip-tags', dest='skip_tags', default=[], action='append', + parser.add_option('--skip-tags', dest='skip_tags', default=C.TAGS_SKIP, action='append', help="only run plays and tasks whose tags do not match these values") if output_opts: diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 520ea7422e3..8de920f0d93 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -1436,6 +1436,22 @@ SYSTEM_WARNINGS: ini: - {key: system_warnings, section: defaults} type: boolean +TAGS_RUN: + name: Run Tags + default: [] + type: list + description: default list of tags to run in your plays, Skip Tags has precedence. + env: [{name: ANSIBLE_RUN_TAGS}] + ini: + - {key: run, section: tags} +TAGS_SKIP: + name: Skip Tags + default: [] + type: list + description: default list of tags to skip in your plays, has precedence over Run Tags + env: [{name: ANSIBLE_SKIP_TAGS}] + ini: + - {key: skip, section: tags} USE_PERSISTENT_CONNECTIONS: name: Persistence default: False