summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2015-02-12 20:58:30 -0500
committerBrian Coca <brian.coca+git@gmail.com>2015-02-13 08:27:07 -0500
commit65c08d1364dd97e784f8a853dda10fbf41542399 (patch)
tree93444a34dec941f2eb0eb314d401a4f8ef8d63a5 /bin
parent6fbbf9c118a9309a29060ca6711abc1eda001f8d (diff)
downloadansible-65c08d1364dd97e784f8a853dda10fbf41542399.tar.gz
added tests
refactored task selection into method list-tasks now uses common method of task selection always is now skippable if specified in --skip-tags
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible-playbook26
1 files changed, 4 insertions, 22 deletions
diff --git a/bin/ansible-playbook b/bin/ansible-playbook
index a3b2958179..2a692a2e3d 100755
--- a/bin/ansible-playbook
+++ b/bin/ansible-playbook
@@ -227,22 +227,6 @@ def main(args):
label = play.name
hosts = pb.inventory.list_hosts(play.hosts)
- # Filter all tasks by given tags
- if pb.only_tags != 'all':
- if options.subset and not hosts:
- continue
- matched_tags, unmatched_tags = play.compare_tags(pb.only_tags)
-
- # Remove skipped tasks
- matched_tags = matched_tags - set(pb.skip_tags)
-
- unmatched_tags.discard('all')
- unknown_tags = ((set(pb.only_tags) | set(pb.skip_tags)) -
- (matched_tags | unmatched_tags))
-
- if unknown_tags:
- continue
-
if options.listhosts:
print ' play #%d (%s): host count=%d' % (playnum, label, len(hosts))
for host in hosts:
@@ -251,12 +235,10 @@ def main(args):
if options.listtasks:
print ' play #%d (%s):' % (playnum, label)
- for task in play.tasks():
- if (set(task.tags).intersection(pb.only_tags) and not
- set(task.tags).intersection(pb.skip_tags)):
- if getattr(task, 'name', None) is not None:
- # meta tasks have no names
- print ' %s' % task.name
+ for task in pb.tasks_to_run_in_play(play):
+ if getattr(task, 'name', None) is not None:
+ # meta tasks have no names
+ print ' %s' % task.name
if options.listhosts or options.listtasks:
print ''
continue