diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index aade5740286532..2ded40737afb57 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -178,6 +178,12 @@ type: list default: version_added: "2.5" + only_transfers_as_changes: + description: + - Only files really transfered are considered as changes. Changing of permissions, ownership or times is NOT considered a change + type: bool + default: no + version_added: "2.10" notes: - rsync must be installed on both the local and remote host. - For the C(synchronize) module, the "local host" is the host `the synchronize task originates on`, and the "destination host" is the host @@ -407,7 +413,8 @@ def main(): partial=dict(type='bool', default=False), verify_host=dict(type='bool', default=False), mode=dict(type='str', default='push', choices=['pull', 'push']), - link_dest=dict(type='list') + link_dest=dict(type='list'), + only_transfers_as_changes=dict(type='bool', default=False) ), supports_check_mode=True, ) @@ -446,6 +453,9 @@ def main(): ssh_args = module.params['ssh_args'] verify_host = module.params['verify_host'] link_dest = module.params['link_dest'] + only_transfers_as_changes = module.params['only_transfers_as_changes'] + if only_transfers_as_changes: + checksum = True if '/' not in rsync: rsync = module.get_bin_path(rsync, required=True) @@ -596,6 +606,8 @@ def _write_password_to_pipe(proc): if link_dest: # a leading period indicates no change changed = (changed_marker + '.') not in out + elif only_transfers_as_changes: + changed = (changed_marker + '<') in out else: changed = changed_marker in out