# rsync module

**URL:** <https://forum.ansible.com/t/rsync-module/12549>\
**Category:** Ansible Project\
**Created:** [March 21, 2013, 7:51am UTC](https://forum.ansible.com/t/rsync-module/12549 "2013-03-21T07:51:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nigel\_Metheringham](https://avatars.discourse-cdn.com/v4/letter/n/3ec8ea/32.png) [@Nigel\_Metheringham](https://forum.ansible.com/u/Nigel_Metheringham)\
**Post date:** [March 21, 2013, 7:51am UTC](https://forum.ansible.com/t/rsync-module/12549/1 "2013-03-21T07:51:14Z")

</div>

A couple of thoughts that have been bubbling around my head following the many mentions of using rsync from within ansible to move sets of files from the management host to the destination host(s).

We can use rsync as a local command, working over its own ssh connection.

However we already have a (potential at least) ssh connection to the target, and ansible may also have the capability to promote the privileges at the target end up to root using sudo - a capability we do not easily have just within rsync.

rsync runs as a client on the local end, and invokes a server process on the remote end. There are magic options (--server and --sender) used to designate what the rsync binary should be doing - these are pretty much undocumented and probably things we aren't meant to be fiddling with (so, a challenge!).

Is there a way we can do that setup for rsync, so that we run rsync --server on the remote end, and hook it up to the output of rsync --sender at the local end in a way that is relatively portable across rsync versions etc, and gives us the ability to add rsync goodness to all the additional capabilities that the copy module has over using local command to invoke rsync?

Comments?

&nbsp;&nbsp;Nigel.

---

<div class="post-metadata">

**Author:** ![Robert\_Parrott](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Robert\_Parrott](https://forum.ansible.com/u/Robert_Parrott)\
**Post date:** [March 21, 2013, 1:19pm UTC](https://forum.ansible.com/t/rsync-module/12549/2 "2013-03-21T13:19:58Z")

</div>

+1 on this

---

<div class="post-metadata">

**Author:** ![Robert\_Parrott](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Robert\_Parrott](https://forum.ansible.com/u/Robert_Parrott)\
**Post date:** [March 21, 2013, 1:26pm UTC](https://forum.ansible.com/t/rsync-module/12549/3 "2013-03-21T13:26:20Z")

</div>

For reference:

[https://pypi.python.org/pypi/pyrsync/0.1.0](https://pypi.python.org/pypi/pyrsync/0.1.0)

---

<div class="post-metadata">

**Author:** ![Dave\_Cottlehuber](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Dave\_Cottlehuber](https://forum.ansible.com/u/Dave_Cottlehuber)\
**Post date:** [March 21, 2013, 1:30pm UTC](https://forum.ansible.com/t/rsync-module/12549/4 "2013-03-21T13:30:24Z")

</div>

Great find! And it appears to support windows too.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [March 21, 2013, 1:32pm UTC](https://forum.ansible.com/t/rsync-module/12549/5 "2013-03-21T13:32:59Z")

</div>

If you are using controlmaster in your .ssh/config you would be  
reusing the ansible connection (when using ssh transport).

---

<div class="post-metadata">

**Author:** ![Dag\_Wieers](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dag\_Wieers](https://forum.ansible.com/u/Dag_Wieers)\
**Post date:** [March 21, 2013, 2:25pm UTC](https://forum.ansible.com/t/rsync-module/12549/6 "2013-03-21T14:25:59Z")

</div>

But it wouldn't work out-of-the-box using paramiko or another connection type. That's why Nigel's implementation (or a python implementation of rsync as suggested) is essential.
