From dddfeac9c418c079f62a48b4c2419adf01dfcba8 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Thu, 7 Feb 2013 18:40:41 +0100 Subject: [PATCH] Allow using ${hostvars.} for nodes not in SETUP_CACHE This allows accessing inventory data from nodes that have not been talked to (yet). --- lib/ansible/runner/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 5d913f50cd..19dc5c997f 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -85,6 +85,9 @@ class HostVars(dict): self.lookup[host] = result return self.lookup[host] + def __contains__(self, host): + return host in self.lookup or host in self.setup_cache or self.inventory.get_host(host) + class Runner(object): ''' core API interface to ansible '''