From b8158f5f6a3fc832a1d6e4ba318090e23f3432ac Mon Sep 17 00:00:00 2001 From: Manuel Faux Date: Fri, 21 Mar 2014 08:40:38 +0100 Subject: [PATCH] Addresses #6591 Hide diff for lineinfile if file did not change. --- lib/ansible/runner/action_plugins/template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/template.py b/lib/ansible/runner/action_plugins/template.py index b34c14ec6a5..34392ba5abd 100644 --- a/lib/ansible/runner/action_plugins/template.py +++ b/lib/ansible/runner/action_plugins/template.py @@ -123,7 +123,8 @@ class ActionModule(object): return ReturnData(conn=conn, comm_ok=True, result=dict(changed=True), diff=dict(before_header=dest, after_header=source, before=dest_contents, after=resultant)) else: res = self.runner._execute_module(conn, tmp, 'copy', module_args, inject=inject, complex_args=complex_args) - res.diff = dict(before=dest_contents, after=resultant) + if res.result['changed']: + res.diff = dict(before=dest_contents, after=resultant) return res else: return self.runner._execute_module(conn, tmp, 'file', module_args, inject=inject, complex_args=complex_args)