Add an isset("$var") function to only_if
This commit is contained in:
parent
ca7b5cc5a3
commit
14db2fa376
1 changed files with 5 additions and 1 deletions
|
@ -538,8 +538,12 @@ class Runner(object):
|
||||||
self.module_args = new_args
|
self.module_args = new_args
|
||||||
self.module_args = utils.template(self.module_args, inject)
|
self.module_args = utils.template(self.module_args, inject)
|
||||||
|
|
||||||
|
def _check_conditional(conditional):
|
||||||
|
def isset(var):
|
||||||
|
return not var.startswith("$")
|
||||||
|
return eval(conditional)
|
||||||
conditional = utils.template(self.conditional, inject)
|
conditional = utils.template(self.conditional, inject)
|
||||||
if not eval(conditional):
|
if not _check_conditional(conditional):
|
||||||
result = utils.jsonify(dict(skipped=True))
|
result = utils.jsonify(dict(skipped=True))
|
||||||
self.callbacks.on_skipped(host, inject.get('item',None))
|
self.callbacks.on_skipped(host, inject.get('item',None))
|
||||||
return ReturnData(host=host, result=result)
|
return ReturnData(host=host, result=result)
|
||||||
|
|
Loading…
Reference in a new issue