mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 03:30:22 -07:00
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:
parent
39e791a1d3
commit
0669ce858a
6 changed files with 284 additions and 382 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue