mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Ensure checkmode is honored for templates that haven't changed
Fixes #8998
This commit is contained in:
@@ -132,5 +132,12 @@ class ActionModule(object):
|
|||||||
res.diff = dict(before=dest_contents, after=resultant)
|
res.diff = dict(before=dest_contents, after=resultant)
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
|
# if we're running in check mode, we still want the file module
|
||||||
|
# to execute, since we can't know if anything would be changed here,
|
||||||
|
# so we inject the check mode param into the module args and rely on
|
||||||
|
# the file module to report its changed status
|
||||||
|
if self.runner.noop_on_check(inject):
|
||||||
|
new_module_args = dict(CHECKMODE=True)
|
||||||
|
module_args = utils.merge_module_args(module_args, new_module_args)
|
||||||
return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args)
|
return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user