From 9837a616ebf0513e7521983c72aa692bc8ab9b62 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sun, 18 Mar 2012 16:58:00 -0400 Subject: [PATCH] Preserve changed data on file and template ops when the mode operations don't result in a change but the files were still replaced. --- lib/ansible/runner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index 8ceec0a78e..1dbe8dca65 100755 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -434,8 +434,9 @@ class Runner(object): results2 = self._return_from_module(conn, host, result2) (host, ok, data2) = results2 new_changed = data2.get('changed', False) - data['changed'] = old_changed or new_changed data.update(data2) + if old_changed or new_changed: + data['changed'] = True return (host, ok, data) else: # copy failed, return orig result without going through 'file' module @@ -483,8 +484,9 @@ class Runner(object): results2 = self._return_from_module(conn, host, result2) (host, ok, data2) = results2 new_changed = data2.get('changed', False) - data['changed'] = old_changed or new_changed data.update(data2) + if old_changed or new_changed: + data['changed'] = True return (host, ok, data) else: # copy failed, return orig result without going through 'file' module