|
|
@ -78,15 +78,15 @@ class LookupModule(LookupBase):
|
|
|
|
raise AnsibleError('Invalid setting identifier, "%s" is not a string, its a %s' % (term, type(term)))
|
|
|
|
raise AnsibleError('Invalid setting identifier, "%s" is not a string, its a %s' % (term, type(term)))
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if term in myvars:
|
|
|
|
try:
|
|
|
|
value = myvars[term]
|
|
|
|
value = myvars[term]
|
|
|
|
elif 'hostvars' in myvars and term in myvars['hostvars']:
|
|
|
|
except KeyError:
|
|
|
|
# maybe it is a host var?
|
|
|
|
try:
|
|
|
|
value = myvars['hostvars'][term]
|
|
|
|
value = myvars['hostvars'][myvars['inventory_hostname']][term]
|
|
|
|
else:
|
|
|
|
except KeyError:
|
|
|
|
raise AnsibleUndefinedVariable('No variable found with this name: %s' % term)
|
|
|
|
raise AnsibleUndefinedVariable('No variable found with this name: %s' % term)
|
|
|
|
ret.append(self._templar.template(value, fail_on_undefined=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret.append(self._templar.template(value, fail_on_undefined=True))
|
|
|
|
except AnsibleUndefinedVariable:
|
|
|
|
except AnsibleUndefinedVariable:
|
|
|
|
if default is not None:
|
|
|
|
if default is not None:
|
|
|
|
ret.append(default)
|
|
|
|
ret.append(default)
|
|
|
|