.. _ansible.posix.synchronize_module:
*************************
ansible.posix.synchronize
*************************
**A wrapper around rsync to make common tasks in your playbooks quick and easy**
Version added: 1.0.0
.. contents::
:local:
:depth: 1
Synopsis
--------
- ``synchronize`` is a wrapper around rsync to make common tasks in your playbooks quick and easy.
- It is run and originates on the local host where Ansible is being run.
- 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.
- This module is not intended to provide access to the full power of rsync, but does make the most common invocations easier to implement. You `still` may need to call rsync directly via ``command`` or ``shell`` depending on your use case.
Parameters
----------
.. raw:: html
Parameter |
Choices/Defaults |
Comments |
archive
boolean
|
|
Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D.
|
checksum
boolean
|
|
Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will not disable it.
|
compress
boolean
|
|
Compress file data during the transfer.
In most cases, leave this enabled unless it causes problems.
|
copy_links
boolean
|
|
Copy symlinks as the item that they point to (the referent) is copied, rather than the symlink.
|
delay_updates
boolean
added in 1.3.0
|
|
This option puts the temporary file from each updated file into a holding directory until the end of the transfer, at which time all the files are renamed into place in rapid succession.
|
delete
boolean
|
|
Delete files in dest that do not exist (after transfer, not before) in the src path.
This option requires recursive=yes.
This option ignores excluded files and behaves like the rsync opt --delete-after .
|
dest
string
/ required
|
|
Path on the destination host that will be synchronized from the source.
The path can be absolute or relative.
|
dest_port
integer
|
|
Port number for ssh on the destination host.
Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value.
This parameter defaults to the value of ansible_port , the remote_port config setting or the value from ssh client configuration if none of the former have been set.
|
dirs
boolean
|
|
Transfer directories without recursing.
|
existing_only
boolean
|
|
Skip creating new files on receiver.
|
group
boolean
|
|
Preserve group.
This parameter defaults to the value of the archive option.
|
link_dest
list
/ elements=string
|
Default:
null
|
Add a destination to hard link against during the rsync.
|
links
boolean
|
|
Copy symlinks as symlinks.
This parameter defaults to the value of the archive option.
|
mode
string
|
|
Specify the direction of the synchronization.
In push mode the localhost or delegate is the source.
In pull mode the remote host in context is the source.
|
owner
boolean
|
|
Preserve owner (super user only).
This parameter defaults to the value of the archive option.
|
partial
boolean
|
|
Tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.
|
perms
boolean
|
|
Preserve permissions.
This parameter defaults to the value of the archive option.
|
private_key
path
|
|
Specify the private key to use for SSH-based rsync connections (e.g. ~/.ssh/id_rsa ).
|
recursive
boolean
|
|
Recurse into directories.
This parameter defaults to the value of the archive option.
|
rsync_opts
list
/ elements=string
|
Default:
null
|
Specify additional rsync options by passing in an array.
Note that an empty string in rsync_opts will end up transfer the current working directory.
|
rsync_path
string
|
|
Specify the rsync command to run on the remote host. See --rsync-path on the rsync man page.
To specify the rsync command to run on the local host, you need to set this your task var ansible_rsync_path .
|
rsync_timeout
integer
|
Default:
0
|
Specify a --timeout for the rsync command in seconds.
|
set_remote_user
boolean
|
|
Put user@ for the remote paths.
If you have a custom ssh config to define the remote user for a host that does not match the inventory user, you should set this parameter to no .
|
src
string
/ required
|
|
Path on the source host that will be synchronized to the destination.
The path can be absolute or relative.
|
ssh_connection_multiplexing
boolean
|
|
SSH connection multiplexing for rsync is disabled by default to prevent misconfigured ControlSockets from resulting in failed SSH connections. This is accomplished by setting the SSH ControlSocket to none .
Set this option to yes to allow multiplexing and reduce SSH connection overhead.
Note that simply setting this option to yes is not enough; You must also configure SSH connection multiplexing in your SSH client config by setting values for ControlMaster , ControlPersist and ControlPath .
|
times
boolean
|
|
Preserve modification times.
This parameter defaults to the value of the archive option.
|
use_ssh_args
boolean
|
|
In Ansible 2.10 and lower, it uses the ssh_args specified in ansible.cfg .
In Ansible 2.11 and onwards, when set to true , it uses all SSH connection configurations like ansible_ssh_args , ansible_ssh_common_args , and ansible_ssh_extra_args .
|
verify_host
boolean
|
|
Verify destination host key.
|