1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Some formatting preferences for --list-hosts and --list-tasks

This commit is contained in:
Michael DeHaan 2013-02-09 11:28:59 -05:00
parent e231708260
commit e564de3983

View file

@ -136,7 +136,9 @@ def main(args):
)
if options.listhosts or options.listtasks:
print ''
print 'playbook: %s' % playbook
print ''
playnum = 0
for (play_ds, play_basedir) in zip(pb.playbook, pb.play_basedirs):
playnum += 1
@ -144,7 +146,7 @@ def main(args):
label = play.name
if options.listhosts:
hosts = pb.inventory.list_hosts(play.hosts)
print ' hosts in play %s (%s): #%d' % (playnum, label, len(hosts))
print ' play #%d (%s): host count=%d' % (playnum, label, len(hosts))
for host in hosts:
print ' %s' % host
if options.listtasks:
@ -156,10 +158,11 @@ def main(args):
unknown = ','.join(sorted(unknown_tags))
unmatched = ','.join(sorted(unmatched_tags))
raise errors.AnsibleError(msg % (unknown, unmatched))
print ' tasks in play %s (%s): #%d' % (playnum, label, len(play.tasks()))
print ' play #%d (%s): task count=%d' % (playnum, label, len(play.tasks()))
for task in play.tasks():
if set(task.tags).intersection(pb.only_tags):
print ' %s' % task.name
print ''
continue
if options.syntax: