mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-11 16:44:22 -07:00
Enable --list-hosts with a list of hosts
This commit is contained in:
parent
a19a13ffa7
commit
5d067497e3
1 changed files with 4 additions and 1 deletions
|
@ -131,7 +131,10 @@ def main(args):
|
||||||
label = 'unnamed'
|
label = 'unnamed'
|
||||||
if 'name' in play:
|
if 'name' in play:
|
||||||
label = play['name']
|
label = play['name']
|
||||||
tmp_hosts = utils.template(pb.basedir, play['hosts'], extra_vars)
|
tmp_hosts = play['hosts']
|
||||||
|
if isinstance(tmp_hosts, list):
|
||||||
|
tmp_hosts = ':'.join(tmp_hosts)
|
||||||
|
tmp_hosts = utils.template(pb.basedir, tmp_hosts, extra_vars)
|
||||||
hosts = pb.inventory.list_hosts(tmp_hosts)
|
hosts = pb.inventory.list_hosts(tmp_hosts)
|
||||||
print ' hosts in play %s (%s): #%d' % (playnum, label, len(hosts))
|
print ' hosts in play %s (%s): #%d' % (playnum, label, len(hosts))
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue