# Transfering large files from one remote machine to another

**URL:** <https://forum.ansible.com/t/transfering-large-files-from-one-remote-machine-to-another/15298>\
**Category:** Ansible Project\
**Created:** [May 21, 2014, 6:16pm UTC](https://forum.ansible.com/t/transfering-large-files-from-one-remote-machine-to-another/15298 "2014-05-21T18:16:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Peters](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@Michael\_Peters](https://forum.ansible.com/u/Michael_Peters)\
**Post date:** [May 21, 2014, 6:16pm UTC](https://forum.ansible.com/t/transfering-large-files-from-one-remote-machine-to-another/15298/1 "2014-05-21T18:16:41Z")

</div>

I was trying to do this via ssh or scp but that's not working (see  
[https://groups.google.com/forum/#!msg/ansible-project/WPVGypBbwlU/mYN5B4wp4ogJ](https://groups.google.com/forum/#!msg/ansible-project/WPVGypBbwlU/mYN5B4wp4ogJ)).  
I need to transfer a file on one server (who's ip is determined via a  
variable and isn't necessarily being managed by ansible) to another  
ansible managed server.

I tried using something like this:

&nbsp;&nbsp;- name: Copy file  
&nbsp;&nbsp;&nbsp;&nbsp;command: 'scp /tmp/file.tar.gz {{ ansible\_all\_ipv4\_addresses[0]  
}}:/tmp/file.tar.gz'  
&nbsp;&nbsp;&nbsp;&nbsp;delegate\_to: '{{ other\_host }}'

Like my problems in the above mentioned discussion this just hangs  
when run via ansible, but runs fine when executed as the same user on  
other\_host.

I was just wondering if there is a better way. I could break it up  
into 2 steps with a fetch and copy but my control server is pretty  
small and these files are going to be pretty large. Surely other  
people have automated the movement of large files in their systems  
with ansible, right?

---

<div class="post-metadata">

**Author:** ![Michael\_Peters](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@Michael\_Peters](https://forum.ansible.com/u/Michael_Peters)\
**Post date:** [May 21, 2014, 6:29pm UTC](https://forum.ansible.com/t/transfering-large-files-from-one-remote-machine-to-another/15298/2 "2014-05-21T18:29:36Z")

</div>

I also tried using a copy with a delegate\_to and that's not working  
either (the src couldn't be found). Here's a playbook and the output  
from the run:

]$ cat test3.yml

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [May 21, 2014, 9:46pm UTC](https://forum.ansible.com/t/transfering-large-files-from-one-remote-machine-to-another/15298/3 "2014-05-21T21:46:30Z")

</div>

Have you tried using the synchronize module for this? Since it’s a wrapper around rsync, you should be able to use it to transfer files from one remote host to another.
