From 5cced79cf3fad7408ed1643ddbf368718103ddac Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 22 Apr 2013 21:35:09 -0400 Subject: [PATCH] Allow variables to be used raw in with_nested --- lib/ansible/runner/lookup_plugins/nested.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/runner/lookup_plugins/nested.py b/lib/ansible/runner/lookup_plugins/nested.py index f96a37d4b4..ebc6e11f8e 100644 --- a/lib/ansible/runner/lookup_plugins/nested.py +++ b/lib/ansible/runner/lookup_plugins/nested.py @@ -42,11 +42,21 @@ class LookupModule(object): def __init__(self, basedir=None, **kwargs): self.basedir = basedir + def __lookup_injects(self, terms, inject): + results = [] + for x in terms: + if isinstance(x, basestring) and x in inject: + results.append(inject[x]) + else: + results.append(x) + return results + def run(self, terms, inject=None, **kwargs): # this code is common with 'items.py' consider moving to utils if we need it again terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject) + terms = self.__lookup_injects(terms, inject) my_list = terms[:] my_list.reverse()