ansible

Ansible Copy vs Synchronize


What are the pros and cons to using Ansible Synchronize vs Copy modules. As far as I can tell synchronize has all the functionality that copy does but may be much faster so I'm considering changing everything to use synchronize. The only downside of synchronize is that rsync is required, which seems fairly ubiquitous in the Linux environment.


Solution

  • 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/latest/collections/ansible/builtin/copy_module.html#id1 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.