mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-28 03:49:09 -07:00
rearranged --list- options, now they are consolidated when used toghether, less loops, more concise output
list-hosts works list-tasks works, but needs better task naming (missing role info) list-tags only shows play tags
This commit is contained in:
parent
b8336f222d
commit
056602c424
2 changed files with 36 additions and 34 deletions
|
@ -121,29 +121,7 @@ class PlaybookExecutor:
|
|||
|
||||
if self._tqm is None:
|
||||
# we are just doing a listing
|
||||
|
||||
pname = new_play.get_name().strip()
|
||||
if pname == 'PLAY: <no name specified>':
|
||||
pname = 'PLAY: #%d' % i
|
||||
p = { 'name': pname }
|
||||
|
||||
if self._options.listhosts:
|
||||
p['pattern']=play.hosts
|
||||
p['hosts']=set(self._inventory.get_hosts(new_play.hosts))
|
||||
|
||||
#TODO: play tasks are really blocks, need to figure out how to get task objects from them
|
||||
elif self._options.listtasks:
|
||||
p['tasks'] = []
|
||||
for task in play.get_tasks():
|
||||
p['tasks'].append(task)
|
||||
#p['tasks'].append({'name': task.get_name().strip(), 'tags': task.tags})
|
||||
|
||||
elif self._options.listtags:
|
||||
p['tags'] = set(new_play.tags)
|
||||
for task in play.get_tasks():
|
||||
p['tags'].update(task)
|
||||
#p['tags'].update(task.tags)
|
||||
entry['plays'].append(p)
|
||||
entry['plays'].append(new_play)
|
||||
|
||||
else:
|
||||
# make sure the tqm has callbacks loaded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue