diff --git a/lib/ansible/plugins/inventory/virtualbox.py b/lib/ansible/plugins/inventory/virtualbox.py index f9b5cbf0491..9ec1aedfa6d 100644 --- a/lib/ansible/plugins/inventory/virtualbox.py +++ b/lib/ansible/plugins/inventory/virtualbox.py @@ -82,15 +82,20 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): for varname in query: hostvars[host][varname] = self._query_vbox_data(host, query[varname]) + strict = self._options.get('strict', False) + # create composite vars - self._set_composite_vars(self.get_option('compose'), hostvars, host) + self._set_composite_vars(self.get_option('compose'), hostvars[host], host, strict=strict) # actually update inventory for key in hostvars[host]: self.inventory.set_variable(host, key, hostvars[host][key]) # constructed groups based on conditionals - self._add_host_to_composed_groups(self.get_option('groups'), hostvars, host) + self._add_host_to_composed_groups(self.get_option('groups'), hostvars[host], host, strict=strict) + + # constructed keyed_groups + self._add_host_to_keyed_groups(self.get_option('keyed_groups'), hostvars[host], host, strict=strict) def _populate_from_cache(self, source_data): hostvars = source_data.pop('_meta', {}).get('hostvars', {})