@ -167,8 +167,10 @@ options:
notes :
notes :
- rsync must be installed on both the local and remote host .
- 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 ` synchronize is connecting to ` .
- For the C ( synchronize ) module , the " local host " is the host ` the synchronize task originates on ` , and the " destination host " is the host ` synchronize is connecting to ` .
- " The user and permissions for the synchronize `src` are those of the user running the Ansible task on the local host, or the `become_user` if `become: yes` is active. synchronize will attempt to escalate privileges to the become_user `on the local host`. "
- The " local host " can be changed to a different host by using ` delegate_to : ` . This enables copying between two remote hosts or entirely on one remote machine .
- The user and permissions for the synchronize ` dest ` are those of the ` remote_user ` on the destination host . If you require permissions ` other ` than those of the remote_user , you must specify this with a sudo command inside the C ( rsync_path ) option in the task ; for example , ` rsync_path = " sudo rsync " ` .
- " The user and permissions for the synchronize `src` are those of the user running the Ansible task on the local host (or the remote_user for a delegate_to host when delegate_to is used).
- The user and permissions for the synchronize ` dest ` are those of the ` remote_user ` on the destination host or the ` become_user ` if ` become : yes ` is active .
- In 2.0 .0 .0 a bug in the synchronize module made become occur on the " local host " . This was fixed in 2.0 .1 .
- Expect that dest = ~ / x will be ~ < remote_user > / x even if using sudo .
- Expect that dest = ~ / x will be ~ < remote_user > / x even if using sudo .
- Inspect the verbose output to validate the destination user / host / path
- Inspect the verbose output to validate the destination user / host / path
are what was expected .
are what was expected .
@ -198,24 +200,27 @@ synchronize: src=some/relative/path dest=/some/absolute/path archive=no links=ye
# Synchronization of two paths both on the control machine
# Synchronization of two paths both on the control machine
local_action : synchronize src = some / relative / path dest = / some / absolute / path
local_action : synchronize src = some / relative / path dest = / some / absolute / path
# Synchronization of src on the inventory host to the dest on the localhost in
# Synchronization of src on the inventory host to the dest on the localhost in pull mode
pull mode
synchronize : mode = pull src = some / relative / path dest = / some / absolute / path
synchronize : mode = pull src = some / relative / path dest = / some / absolute / path
# Synchronization of src on delegate host to dest on the current inventory host.
# Synchronization of src on delegate host to dest on the current inventory host.
# If delegate_to is set to the current inventory host, this can be used to synchronize
# two directories on that host.
synchronize :
synchronize :
src : some / relativ e/ path
src : / first / absolute / path
dest : / s om e/ absolute / path
dest : / s econd / absolute / path
delegate_to : delegate . host
delegate_to : delegate . host
# Synchronize two directories on one remote host.
synchronize :
src : / first / absolute / path
dest : / second / absolute / path
delegate_to : " {{ inventory_hostname }} "
# Synchronize and delete files in dest on the remote host that are not found in src of localhost.
# Synchronize and delete files in dest on the remote host that are not found in src of localhost.
synchronize : src = some / relative / path dest = / some / absolute / path delete = yes
synchronize : src = some / relative / path dest = / some / absolute / path delete = yes
# Synchronize using an alternate rsync command
# Synchronize using an alternate rsync command
# This specific command is granted sudo privileges on the destination
# This specific command is granted su privileges on the destination
synchronize : src = some / relative / path dest = / some / absolute / path rsync_path = " sudo rsync "
synchronize : src = some / relative / path dest = / some / absolute / path rsync_path = " su -c rsync"
# Example .rsync-filter file in the source directory
# Example .rsync-filter file in the source directory
- var # exclude any path whose last part is 'var'
- var # exclude any path whose last part is 'var'