From e3895840d1f4a70990c6683b9ad6b21f204949ee Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 18 Aug 2014 12:27:03 -0500 Subject: [PATCH] Make sure group_vars/all is loaded for ungrouped hosts Fixes #6563 --- lib/ansible/inventory/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index a0f8a39942..00ee28debb 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -450,6 +450,10 @@ class Inventory(object): vars = {} + # special case for ungrouped hosts, make sure group_vars/all is loaded + if len(host.groups) == 1 and host.groups[0].name == 'ungrouped': + vars = self.get_group_variables('all', vault_password=self._vault_password) + # plugin.run retrieves all vars (also from groups) for host vars_results = [ plugin.run(host, vault_password=vault_password) for plugin in self._vars_plugins if hasattr(plugin, 'run')] for updated in vars_results: