From 5d067497e3eb4937dcf13bc5a5e3785d16a186f6 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Sun, 13 Jan 2013 15:15:44 +0100 Subject: [PATCH] Enable --list-hosts with a list of hosts --- bin/ansible-playbook | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 7375017a7ed..f6c8a102176 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -131,7 +131,10 @@ def main(args): label = 'unnamed' if 'name' in play: 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) print ' hosts in play %s (%s): #%d' % (playnum, label, len(hosts)) for host in hosts: