Refactored inventory to make it object oriented, need to make YAML format and executable script

format compatible with this still, and add some tests for INI-style groups of groups
and variables.
This commit is contained in:
Michael DeHaan 2012-05-05 16:31:03 -04:00
parent 39e791a1d3
commit 0669ce858a
6 changed files with 284 additions and 382 deletions

View file

@ -108,12 +108,12 @@ 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_global_vars())
self.global_vars.update(ansible.inventory.Inventory(host_list).get_group_variables('all'))
self.inventory = ansible.inventory.Inventory(override_hosts)
else:
self.inventory = ansible.inventory.Inventory(host_list)
self.global_vars.update(ansible.inventory.Inventory(host_list).get_global_vars())
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)