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:
parent
e231708260
commit
e564de3983
1 changed files with 5 additions and 2 deletions
|
@ -136,7 +136,9 @@ def main(args):
|
||||||
)
|
)
|
||||||
|
|
||||||
if options.listhosts or options.listtasks:
|
if options.listhosts or options.listtasks:
|
||||||
|
print ''
|
||||||
print 'playbook: %s' % playbook
|
print 'playbook: %s' % playbook
|
||||||
|
print ''
|
||||||
playnum = 0
|
playnum = 0
|
||||||
for (play_ds, play_basedir) in zip(pb.playbook, pb.play_basedirs):
|
for (play_ds, play_basedir) in zip(pb.playbook, pb.play_basedirs):
|
||||||
playnum += 1
|
playnum += 1
|
||||||
|
@ -144,7 +146,7 @@ def main(args):
|
||||||
label = play.name
|
label = play.name
|
||||||
if options.listhosts:
|
if options.listhosts:
|
||||||
hosts = pb.inventory.list_hosts(play.hosts)
|
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:
|
for host in hosts:
|
||||||
print ' %s' % host
|
print ' %s' % host
|
||||||
if options.listtasks:
|
if options.listtasks:
|
||||||
|
@ -156,10 +158,11 @@ def main(args):
|
||||||
unknown = ','.join(sorted(unknown_tags))
|
unknown = ','.join(sorted(unknown_tags))
|
||||||
unmatched = ','.join(sorted(unmatched_tags))
|
unmatched = ','.join(sorted(unmatched_tags))
|
||||||
raise errors.AnsibleError(msg % (unknown, unmatched))
|
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():
|
for task in play.tasks():
|
||||||
if set(task.tags).intersection(pb.only_tags):
|
if set(task.tags).intersection(pb.only_tags):
|
||||||
print ' %s' % task.name
|
print ' %s' % task.name
|
||||||
|
print ''
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if options.syntax:
|
if options.syntax:
|
||||||
|
|
Loading…
Add table
Reference in a new issue