1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #5127 from ovcharenko/patches

synchronize module: Added existing_only options to skip creating new files on receiver
This commit is contained in:
jctanner 2014-02-05 11:49:05 -05:00
commit 825a20780f

View file

@ -51,6 +51,13 @@ options:
choices: [ 'yes', 'no' ] choices: [ 'yes', 'no' ]
default: 'yes' default: 'yes'
required: false required: false
existing_only:
description:
- Skip creating new files on receiver.
choices: [ 'yes', 'no' ]
default: 'no'
required: false
version_added: "1.5"
delete: delete:
description: description:
- Delete files that don't exist (after transfer, not before) in the C(src) path. - Delete files that don't exist (after transfer, not before) in the C(src) path.
@ -166,6 +173,7 @@ def main():
private_key = dict(default=None), private_key = dict(default=None),
rsync_path = dict(default=None), rsync_path = dict(default=None),
archive = dict(default='yes', type='bool'), archive = dict(default='yes', type='bool'),
existing_only = dict(default='no', type='bool'),
dirs = dict(default='no', type='bool'), dirs = dict(default='no', type='bool'),
recursive = dict(type='bool'), recursive = dict(type='bool'),
links = dict(type='bool'), links = dict(type='bool'),
@ -188,6 +196,7 @@ def main():
rsync = module.params.get('local_rsync_path', 'rsync') rsync = module.params.get('local_rsync_path', 'rsync')
rsync_timeout = module.params.get('rsync_timeout', 'rsync_timeout') rsync_timeout = module.params.get('rsync_timeout', 'rsync_timeout')
archive = module.params['archive'] archive = module.params['archive']
existing_only = module.params['existing_only']
dirs = module.params['dirs'] dirs = module.params['dirs']
# the default of these params depends on the value of archive # the default of these params depends on the value of archive
recursive = module.params['recursive'] recursive = module.params['recursive']
@ -203,6 +212,8 @@ def main():
cmd = cmd + ' --dry-run' cmd = cmd + ' --dry-run'
if delete: if delete:
cmd = cmd + ' --delete-after' cmd = cmd + ' --delete-after'
if existing_only:
cmd = cmd + ' --existing'
if archive: if archive:
cmd = cmd + ' --archive' cmd = cmd + ' --archive'
if recursive is False: if recursive is False: