From 892212b9c434bb4d3f8c0a788f9155284d50f209 Mon Sep 17 00:00:00 2001 From: Juan Picca Date: Thu, 12 Feb 2015 09:25:36 -0200 Subject: [PATCH] synchronize module: add partial option --- files/synchronize.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/files/synchronize.py b/files/synchronize.py index 7f934e4e6f4..761529742de 100644 --- a/files/synchronize.py +++ b/files/synchronize.py @@ -152,6 +152,12 @@ options: default: required: false version_added: "1.6" + partial: + description: + - Tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster. + default: no + required: false + version_added: "1.9" notes: - rsync must be installed on both the local and remote machine. - Inspect the verbose output to validate the destination user/host/path @@ -237,6 +243,7 @@ def main(): rsync_timeout = dict(type='int', default=0), rsync_opts = dict(type='list'), ssh_args = dict(type='str'), + partial = dict(default='no', type='bool'), ), supports_check_mode = True ) @@ -254,6 +261,7 @@ def main(): compress = module.params['compress'] existing_only = module.params['existing_only'] dirs = module.params['dirs'] + partial = module.params['partial'] # the default of these params depends on the value of archive recursive = module.params['recursive'] links = module.params['links'] @@ -332,6 +340,9 @@ def main(): if rsync_opts: cmd = cmd + " " + " ".join(rsync_opts) + if partial: + cmd = cmd + " --partial" + changed_marker = '<>' cmd = cmd + " --out-format='" + changed_marker + "%i %n%L'"