adds complex tag management

Adds a special tag:
 - always: always runs no matter what --tags, --skip-tags say

Adds 4 special keywords for --tags/skip-tags
 - all: all tagged + untagged tasks
 - tagged: only tagged tasks
 - untagged: only untagged tasks
 - always: only run tasks tagged 'always'
This commit is contained in:
Brian Coca 2015-02-08 22:51:18 -05:00
parent f61de115cd
commit 95fa770ba0
3 changed files with 59 additions and 14 deletions

View file

@ -129,7 +129,7 @@ class Task(object):
# load various attributes
self.name = ds.get('name', None)
self.tags = [ 'all' ]
self.tags = [ 'untagged' ]
self.register = ds.get('register', None)
self.sudo = utils.boolean(ds.get('sudo', play.sudo))
self.su = utils.boolean(ds.get('su', play.su))
@ -316,6 +316,9 @@ class Task(object):
self.tags.extend(apply_tags)
self.tags.extend(import_tags)
if len(self.tags) > 1:
self.tags.remove('untagged')
if additional_conditions:
new_conditions = additional_conditions[:]
if self.when: