ANSIBLE.SYNCHRONIZE(3)

NAME
synchronize - 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 command or shell depending on your use case. The synchronize action is meant to do common things with rsync easily. It does not provide access to the full power of rsync, but does make most invocations easier to follow.

OPTIONS

archive
    Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D. Choices: yes,no. (default: yes)

delete
    Delete files that don't exist (after transfer, not before) in the src path. Choices: yes,no. (default: no)

dest
    Path on the destination machine that will be synchronized from the source; The path can be absolute or relative.(required)

dirs
    Transfer directories without recursing Choices: yes,no. (default: no)

group
    Preserve group Choices: yes,no. (default: the value of the archive option)

links
    Copy symlinks as symlinks. Choices: yes,no. (default: the value of the archive option)

mode
    Specify the direction of the synchroniztion. In push mode the localhost or delgate is the source; In pull mode the remote host in context is the source. Choices: push,pull. (default: push)

owner
    Preserve owner (super user only) Choices: yes,no. (default: the value of the archive option)

perms
    Preserve permissions. Choices: yes,no. (default: the value of the archive option)

recursive
    Recurse into directories. Choices: yes,no. (default: the value of the archive option)

rsync_path
    Specify the rsync command to run on the remote machine. See --rsync-path on the rsync man page.

rsync_timeout
    Specify a --timeout for the rsync command in seconds. (default: 10)

src Path on the source machine that will be synchronized to the destination; The path can be absolute or relative.(required)

times
    Preserve modification times Choices: yes,no. (default: the value of the archive option).

NOTES

Inspect the verbose output to validate the destination user/host/path are what was expected.

The remote user for the dest path will always be the remote_user, not the sudo_user.

Expect that dest=~/x will be ~<remote_user>/x even if using sudo.

EXAMPLES
# Synchronization of src on the control machine to dest on the remote hosts
synchronize: src=some/relative/path dest=/some/absolute/path
# Synchronization without any --archive options enabled
synchronize: src=some/relative/path dest=/some/absolute/path archive=no
# Synchronization with --archive options enabled except for --recursive
synchronize: src=some/relative/path dest=/some/absolute/path recursive=no
# Synchronization without --archive options enabled except use --links
synchronize: src=some/relative/path dest=/some/absolute/path archive=no links=yes
# Synchronization of two paths both on the control machine
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
pull mode
synchronize: mode=pull src=some/relative/path dest=/some/absolute/path
# Synchronization of src on delegate host to dest on the current inventory host
synchronize: >
    src=some/relative/path dest=/some/absolute/path
    delegate_to: delegate.host
# 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 using an alternate rsync command
synchronize: src=some/relative/path dest=/some/absolute/path rsync_path="sudo rsync"

AUTHOR
Timothy Appnel

SEE ALSO
ansible(1), http://ansible.github.com/modules.html#synchronize