Ansible Copy vs Synchronize

The differences are pretty similar to traditional rsync vs scp. Rsync has more features and is often faster, however it's a little bit trickier to setup and has more knobs to turn.

Additionally, https://docs.ansible.com/ansible/copy_module.html states:

The “copy” module recursively copy facility does not scale to lots (>hundreds) of files. For alternative, see synchronize module, which is a wrapper around rsync.


As of Ansible v2.8, synchronize is still in “preview” status:

This module is not guaranteed to have a backwards compatible interface. [preview]

In Ansible v2.10, the copy module is moved to the Builtin Collection, which is officially maintained by the core team (i.e. Red Hat), and distributed with ansible-base (a.k.a. ansible-core). In contrast, synchronize is moved to the POSIX Collection maintained by community.

I would use copy when I don’t need the performance and functionality of synchronize. I suggest starting with copy, and move to synchronize only when this is the bottleneck. (Verify this with benchmark!)

Tags:

Ansible