mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 22:51:23 -07:00
now all --list options are working!
This commit is contained in:
parent
884435a1aa
commit
c0c094c413
1 changed files with 17 additions and 12 deletions
|
@ -159,28 +159,33 @@ class PlaybookCLI(CLI):
|
||||||
playname = '#' + str(i)
|
playname = '#' + str(i)
|
||||||
|
|
||||||
msg = "\n PLAY: %s" % (playname)
|
msg = "\n PLAY: %s" % (playname)
|
||||||
if self.options.listtags:
|
mytags = set()
|
||||||
mytags = set(play.tags)
|
if self.options.listtags and play.tags:
|
||||||
msg += '\n tags: [%s]' % (','.join(mytags))
|
mytags = mytags.union(set(play.tags))
|
||||||
|
msg += '\n tags: [%s]' % (','.join(mytags))
|
||||||
|
|
||||||
if self.options.listhosts:
|
if self.options.listhosts:
|
||||||
playhosts = set(inventory.get_hosts(play.hosts))
|
playhosts = set(inventory.get_hosts(play.hosts))
|
||||||
msg += "\n pattern: %s\n total hosts: %d\n hosts:" % (play.hosts, len(playhosts))
|
msg += "\n pattern: %s\n total hosts: %d\n hosts:" % (play.hosts, len(playhosts))
|
||||||
for host in playhosts:
|
for host in playhosts:
|
||||||
msg += "\n %s" % host
|
msg += "\n %s" % host
|
||||||
|
|
||||||
self.display.display(msg)
|
self.display.display(msg)
|
||||||
|
|
||||||
if self.options.listtags or self.options.listtasks:
|
if self.options.listtags or self.options.listtasks:
|
||||||
j = 1
|
taskmsg = ' tasks:'
|
||||||
taskmsg = ' tasks:'
|
|
||||||
|
for block in play.compile():
|
||||||
|
if not block.has_tasks():
|
||||||
|
continue
|
||||||
|
|
||||||
|
j = 1
|
||||||
|
for task in block.block:
|
||||||
|
taskmsg += "\n %s" % task
|
||||||
|
if self.options.listtags and task.tags:
|
||||||
|
taskmsg += "\n tags: [%s]" % ','.join(mytags.union(set(task.tags)))
|
||||||
|
j = j + 1
|
||||||
|
|
||||||
for task in play.get_tasks():
|
|
||||||
taskmsg += "\n %s" % task
|
|
||||||
if self.options.listtags:
|
|
||||||
pass
|
|
||||||
#taskmsg += " %s" % ','.join(mytags.union(set(task.tags))) #FIXME: find out how to get task tags
|
|
||||||
j = j + 1
|
|
||||||
self.display.display(taskmsg)
|
self.display.display(taskmsg)
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue