diff options
author | James Cammarata <jimi@sngx.net> | 2014-09-15 11:29:04 -0500 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2014-09-24 13:55:28 -0500 |
commit | af269a1524bf2a0e9db3174b1c68ba6c21080394 (patch) | |
tree | 5bcb90022d50ff6126519c1973e5b4844577e794 | |
parent | 085ba4ffd828f0ee24fca84f9200084ff8c3580d (diff) | |
download | ansible-af269a1524bf2a0e9db3174b1c68ba6c21080394.tar.gz |
Ensure checkmode is honored for templates that haven't changed
Fixes #8998
-rw-r--r-- | lib/ansible/runner/action_plugins/template.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ansible/runner/action_plugins/template.py b/lib/ansible/runner/action_plugins/template.py index b16e5f66e6..0348035bf5 100644 --- a/lib/ansible/runner/action_plugins/template.py +++ b/lib/ansible/runner/action_plugins/template.py @@ -132,5 +132,12 @@ class ActionModule(object): res.diff = dict(before=dest_contents, after=resultant) return res 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) |