From a8f0b5fd06ce4069a0d86c5b4ded3b0be96bbb82 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sun, 6 May 2012 15:00:17 -0400 Subject: [PATCH] Fix playbooks such that they work with external inventory scripts. We really want to find out why the 'all' group isn't available, but group vars don't make sense for external inventory anyway. --- lib/ansible/playbook.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/playbook.py b/lib/ansible/playbook.py index 373db3cf06..57d9af5edd 100644 --- a/lib/ansible/playbook.py +++ b/lib/ansible/playbook.py @@ -108,12 +108,13 @@ class PlayBook(object): if override_hosts is not None: if type(override_hosts) != list: raise errors.AnsibleError("override hosts must be a list") - self.global_vars.update(ansible.inventory.Inventory(host_list).get_group_variables('all')) - self.inventory = ansible.inventory.Inventory(override_hosts) + if not self.inventory._is_script: + self.global_vars.update(ansible.inventory.Inventory(host_list).get_group_variables('all')) else: self.inventory = ansible.inventory.Inventory(host_list) - self.global_vars.update(ansible.inventory.Inventory(host_list).get_group_variables('all')) + if not self.inventory._is_script: + self.global_vars.update(ansible.inventory.Inventory(host_list).get_group_variables('all')) self.basedir = os.path.dirname(playbook) self.playbook = self._parse_playbook(playbook)