summaryrefslogtreecommitdiff
path: root/lib/ansible/vars/hostvars.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/vars/hostvars.py')
-rw-r--r--lib/ansible/vars/hostvars.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/vars/hostvars.py b/lib/ansible/vars/hostvars.py
index faf471fd78..1e2ac7e292 100644
--- a/lib/ansible/vars/hostvars.py
+++ b/lib/ansible/vars/hostvars.py
@@ -62,7 +62,7 @@ class HostVars(collections.Mapping):
self._inventory = inventory
def _find_host(self, host_name):
- if host_name in C.LOCALHOST:
+ if host_name in C.LOCALHOST and self._inventory.localhost:
host = self._inventory.localhost
else:
host = self._inventory.get_host(host_name)