mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-13 03:44:02 -07:00
Introduce the 'always_run' task clause.
The 'always_run' task clause allows one to execute a task even in check mode. While here implement Runner.noop_on_check() to check if a runner really should execute its task, with respect to check mode option and 'always_run' clause. Also add the optional 'jinja2' argument to check_conditional() : it allows to give this function a jinja2 expression without exposing the 'jinja2_compare' implementation mechanism.
This commit is contained in:
parent
7ac3bbc198
commit
f0743fc32a
14 changed files with 136 additions and 13 deletions
|
@ -126,7 +126,7 @@ class ActionModule(object):
|
|||
else:
|
||||
diff = {}
|
||||
|
||||
if self.runner.check:
|
||||
if self.runner.noop_on_check(inject):
|
||||
if content is not None:
|
||||
os.remove(tmp_content)
|
||||
return ReturnData(conn=conn, result=dict(changed=True), diff=diff)
|
||||
|
@ -172,7 +172,7 @@ class ActionModule(object):
|
|||
# don't send down raw=no
|
||||
module_args.pop('raw')
|
||||
module_args = "%s src=%s" % (module_args, pipes.quote(tmp_src))
|
||||
if self.runner.check:
|
||||
if self.runner.noop_on_check(inject):
|
||||
module_args = "%s CHECKMODE=True" % module_args
|
||||
return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue