From 4e1bc436451e802756bab4b593a16b839c86e3c2 Mon Sep 17 00:00:00 2001 From: jkleint Date: Tue, 24 Apr 2012 17:54:00 -0300 Subject: [PATCH] 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 ';'. --- lib/ansible/playbook.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/playbook.py b/lib/ansible/playbook.py index 0a5d976a3dc..4da4975177a 100644 --- a/lib/ansible/playbook.py +++ b/lib/ansible/playbook.py @@ -544,6 +544,8 @@ class PlayBook(object): # get configuration information about the pattern pattern = pg.get('hosts',None) + if isinstance(pattern, list): + pattern = ';'.join(pattern) if self.override_hosts: pattern = 'all' if pattern is None: