From 2814828bc94b4f2ef777c981974b3f5caf53f310 Mon Sep 17 00:00:00 2001 From: Aleksey Ovcharenko Date: Fri, 22 Nov 2013 23:59:57 +0200 Subject: [PATCH 1/4] Added existing_only options to skip creating new files on receiver --- library/files/synchronize | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/files/synchronize b/library/files/synchronize index 9acc4d4662..26e50274be 100644 --- a/library/files/synchronize +++ b/library/files/synchronize @@ -46,6 +46,12 @@ options: choices: [ 'yes', 'no' ] default: 'yes' required: false + existing_only: + description: + - Skip creating new files on receiver. + choices: [ 'yes', 'no' ] + default: 'no' + required: false delete: description: - Delete files that don't exist (after transfer, not before) in the C(src) path. @@ -154,6 +160,7 @@ def main(): private_key = dict(default=None), rsync_path = dict(default=None), archive = dict(default='yes', type='bool'), + existing_only = dict(default='no', type='bool'), dirs = dict(default='no', type='bool'), recursive = dict(type='bool'), links = dict(type='bool'), @@ -174,6 +181,7 @@ def main(): rsync = module.params.get('local_rsync_path', 'rsync') rsync_timeout = module.params.get('rsync_timeout', 'rsync_timeout') archive = module.params['archive'] + existing_only = module.params['existing_only'], dirs = module.params['dirs'] # the default of these params depends on the value of archive recursive = module.params['recursive'] @@ -188,6 +196,8 @@ def main(): cmd = cmd + ' --dry-run' if delete: cmd = cmd + ' --delete-after' + if existing_only: + cmd = cmd + ' --existing' if archive: cmd = cmd + ' --archive' if recursive is False: From bcd7af3991d1b31b27370180c7c87aabd7c4b4e2 Mon Sep 17 00:00:00 2001 From: Aleksey Ovcharenko Date: Mon, 2 Dec 2013 16:35:44 +0200 Subject: [PATCH 2/4] Fixed a typo. --- library/files/synchronize | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/files/synchronize b/library/files/synchronize index 26e50274be..ab02bd85cf 100644 --- a/library/files/synchronize +++ b/library/files/synchronize @@ -181,7 +181,7 @@ def main(): rsync = module.params.get('local_rsync_path', 'rsync') rsync_timeout = module.params.get('rsync_timeout', 'rsync_timeout') archive = module.params['archive'] - existing_only = module.params['existing_only'], + existing_only = module.params['existing_only'] dirs = module.params['dirs'] # the default of these params depends on the value of archive recursive = module.params['recursive'] From dcf0fdb9e2e6a532d4825e57fd72abe79a48f2de Mon Sep 17 00:00:00 2001 From: Aleksey Ovcharenko Date: Mon, 16 Dec 2013 19:20:02 +0200 Subject: [PATCH 3/4] Added version_added --- library/files/synchronize | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/files/synchronize b/library/files/synchronize index ab02bd85cf..eacebe6da3 100644 --- a/library/files/synchronize +++ b/library/files/synchronize @@ -21,7 +21,7 @@ import subprocess DOCUMENTATION = ''' --- module: synchronize -version_added: "1.4" +version_added: "1.5" short_description: Uses rsync to make synchronizing file paths in your playbooks quick and easy. description: - This is a wrapper around rsync. Of course you could just use the command action to call rsync yourself, but you also have to add a fair number of boilerplate options and host facts. You still may need to call rsync directly via C(command) or C(shell) depending on your use case. The synchronize action is meant to do common things with C(rsync) easily. It does not provide access to the full power of rsync, but does make most invocations easier to follow. @@ -52,6 +52,7 @@ options: choices: [ 'yes', 'no' ] default: 'no' required: false + version_added: "1.5" delete: description: - Delete files that don't exist (after transfer, not before) in the C(src) path. From c57445c5f3365cb6bba8be4254aceb525711d9dd Mon Sep 17 00:00:00 2001 From: Aleksey Ovcharenko Date: Fri, 3 Jan 2014 17:22:10 +0200 Subject: [PATCH 4/4] Downgraded module version_added. --- library/files/synchronize | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/files/synchronize b/library/files/synchronize index eacebe6da3..ff166f510a 100644 --- a/library/files/synchronize +++ b/library/files/synchronize @@ -21,7 +21,7 @@ import subprocess DOCUMENTATION = ''' --- module: synchronize -version_added: "1.5" +version_added: "1.4" short_description: Uses rsync to make synchronizing file paths in your playbooks quick and easy. description: - This is a wrapper around rsync. Of course you could just use the command action to call rsync yourself, but you also have to add a fair number of boilerplate options and host facts. You still may need to call rsync directly via C(command) or C(shell) depending on your use case. The synchronize action is meant to do common things with C(rsync) easily. It does not provide access to the full power of rsync, but does make most invocations easier to follow.