mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 11:40:22 -07:00
allowing json in lookup template calls
This commit is contained in:
parent
4fd4f3374a
commit
ecae636160
1 changed files with 2 additions and 1 deletions
|
@ -27,6 +27,7 @@ class LookupModule(LookupBase):
|
||||||
|
|
||||||
def run(self, terms, variables, **kwargs):
|
def run(self, terms, variables, **kwargs):
|
||||||
|
|
||||||
|
convert_data_p = kwargs.get('convert_data', True)
|
||||||
basedir = self.get_basedir(variables)
|
basedir = self.get_basedir(variables)
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
|
@ -46,7 +47,7 @@ class LookupModule(LookupBase):
|
||||||
searchpath.insert(1, variables['role_path'])
|
searchpath.insert(1, variables['role_path'])
|
||||||
|
|
||||||
self._templar.environment.loader.searchpath = searchpath
|
self._templar.environment.loader.searchpath = searchpath
|
||||||
res = self._templar.template(template_data, preserve_trailing_newlines=True)
|
res = self._templar.template(template_data, preserve_trailing_newlines=True,convert_data=convert_data_p)
|
||||||
ret.append(res)
|
ret.append(res)
|
||||||
else:
|
else:
|
||||||
raise AnsibleError("the template file %s could not be found for the lookup" % term)
|
raise AnsibleError("the template file %s could not be found for the lookup" % term)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue