diff --git a/lib/ansible/plugins/inventory/openstack.py b/lib/ansible/plugins/inventory/openstack.py index 74fb68ee24c..9c9a1e03001 100644 --- a/lib/ansible/plugins/inventory/openstack.py +++ b/lib/ansible/plugins/inventory/openstack.py @@ -240,7 +240,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): # create composite vars self._set_composite_vars( - self._config_data.get('compose'), hostvars, host) + self._config_data.get('compose'), hostvars[host], host) # actually update inventory for key in hostvars[host]: @@ -248,7 +248,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): # constructed groups based on conditionals self._add_host_to_composed_groups( - self._config_data.get('groups'), hostvars, host) + self._config_data.get('groups'), hostvars[host], host) + + # constructed groups based on jinja expressions + self._add_host_to_keyed_groups( + self._config_data.get('keyed_groups'), hostvars[host], host) for group_name, group_hosts in groups.items(): self.inventory.add_group(group_name) diff --git a/test/units/plugins/inventory/test_openstack.py b/test/units/plugins/inventory/test_openstack.py index a9cbaba0849..fec7ae580c4 100644 --- a/test/units/plugins/inventory/test_openstack.py +++ b/test/units/plugins/inventory/test_openstack.py @@ -68,7 +68,7 @@ def inventory(): return inventory -def test_simpel_groups(inventory): +def test_simple_groups(inventory): inventory._set_variables(hostvars, {}) groups = inventory.inventory.get_groups_dict() assert 'testgroup' in groups