Commit 4e1bc436 by jkleint

Support YAML lists of hosts in playbooks.

Reading the docs, I was a bit confused as to how to specify multiple hosts/groups in a playbook.  Being YAML, I assumed a normal YAML list would work:

    ---
    - hosts: [host1, host2]

But this crashes when inventory._matches() assumes hosts is a string.  This patch just checks if hosts is a list, and turns it into a string joined by ';'.
parent b50c5074
...@@ -544,6 +544,8 @@ class PlayBook(object): ...@@ -544,6 +544,8 @@ class PlayBook(object):
# get configuration information about the pattern # get configuration information about the pattern
pattern = pg.get('hosts',None) pattern = pg.get('hosts',None)
if isinstance(pattern, list):
pattern = ';'.join(pattern)
if self.override_hosts: if self.override_hosts:
pattern = 'all' pattern = 'all'
if pattern is None: if pattern is None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment