# How to copy  files from src(ansible controller )  to dest ( target hosts)

**URL:** <https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288>\
**Category:** Ansible Project\
**Created:** [December 6, 2020, 2:16am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288 "2020-12-06T02:16:47Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 6, 2020, 2:16am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/1 "2020-12-06T02:16:47Z")

</div>

Hi ,

How to copy the zip file size \> 250 MB from src(ansible controller ) to dest ( target hosts) ?

I wrote the playbook as below but it didn’t working due to my zip file size is more than 700 MB

**-**  **name** : Copy files from src(local) to dest (hosts)

**copy** :

**src** : “{{ local\_source\_directory }}/Java8.jre.8.0.0.616.tar”

**dest** : “{{ patch\_directory }}/”

**force** : no

Kindly advise here …

Regards,

Prathap

---

<div class="post-metadata">

**Author:** ![Nuno\_Jordao](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@Nuno\_Jordao](https://forum.ansible.com/u/Nuno_Jordao)\
**Post date:** [December 6, 2020, 3:11am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/2 "2020-12-06T03:11:26Z")

</div>

Hello,

It may be more efficient to store the file in a central http repository and use “get\_url” module to copy it to the target machine.

Regards,

Nuno

---

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 6, 2020, 3:34am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/3 "2020-12-06T03:34:13Z")

</div>

Thank you for your email !!!

Ok , but just I would like to know if we are able to copy the more 250 MB files to target hosts from ansible controller machine … If yes , How we can write a task for that ?

Regards ,  
Prathap

---

<div class="post-metadata">

**Author:** ![Idan\_Melamed](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@Idan\_Melamed](https://forum.ansible.com/u/Idan_Melamed)\
**Post date:** [December 6, 2020, 7:43am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/4 "2020-12-06T07:43:58Z")

</div>

Hi Prathap,

Maybe this will help?  
[https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize\_module.html](https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html)

---

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 6, 2020, 7:47am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/5 "2020-12-06T07:47:02Z")

</div>

Ho Ida ,

Thank you , I will try and share the result

---

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 6, 2020, 8:00am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/6 "2020-12-06T08:00:21Z")

</div>

Getting below error …

TASK [directories : Synchronization of src on the control machine to dest on the remote hosts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

fatal: [vmpwr0023]: FAILED! =\> {“changed”: false, “cmd”: “/usr/bin/rsync --delay-updates -F --compress --archive --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null --out-format=\<\>%i %n%L /u01/ansible/sw/fmw\_12.2.1.4.0\_infrastructure\_Disk1\_1of1.zip [oracle@172.20.8.90](mailto:oracle@172.20.8.90):/u01/staging/patches”, “msg”: “ssh: connect to host 172.20.8.90 port 22: Connection timed out\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: unexplained error (code 255) at io.c(226) [sender=3.1.3]\n”, “rc”: 255}

This is playbook:

**-**  **name** : Synchronization of src on the control machine to dest on the remote hosts

**synchronize** :

**src** : “{{ local\_source\_directory }}/fmw\_12.2.1.4.0\_infrastructure\_Disk1\_1of1.zip”

**dest** : “{{ patch\_directory }}”

Regards,

Prathap

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 6, 2020, 9:44pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/7 "2020-12-06T21:44:47Z")

</div>

Where does this size limit come from?  
I don’t recall this being an ansible issue.  
Also you’re talking about a zip file while your taks lists a tar file. Those are distinctly different files.  
Thirdly what does “it didn’t working” mean?  
Is that your interpretation of an error?  
If so, what is that error?

---

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 6, 2020, 10:56pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/8 "2020-12-06T22:56:43Z")

</div>

Hi ,

I would like to copy more than 500 MB files from ansible host to remote host … kindly suggest me how to do that ?

Regards ,  
Prathap

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 7, 2020, 10:23am UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/9 "2020-12-07T10:23:03Z")

</div>

Hi  
It doesn't work like that.  
Please answer the questions first, so we can better understand your problem.

---

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 7, 2020, 12:00pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/10 "2020-12-07T12:00:02Z")

</div>

Hi ‘

I have downloaded that software from oracle site on my lap to install weblogic and the file size is more than 500 MB …

Regards,  
Prathap

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 7, 2020, 12:23pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/11 "2020-12-07T12:23:30Z")

</div>

Still not enough information.  
What is the actual problem?

---

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 7, 2020, 12:28pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/12 "2020-12-07T12:28:44Z")

</div>

Ok .

I want to transfer the zip files from ansible controller host to target hosts by using ansible but the zip file is more than 500 MB so I am getting timeout errors when trying copy them by using synchronisation model .

Regards  
Prathap

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 7, 2020, 12:59pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/13 "2020-12-07T12:59:09Z")

</div>

OK i see the error in one of your previous messages, i didn't spot that.  
So there is an issue that prevents large files from being transferred  
from your controller to the host, as both the copy and the synchronize  
module fail.  
This indicates it is not an ansible problem.  
So, fix this by taking ansible out of the loop, and debug manually  
(using scp or rsync).  
Once those work, ansible (which relies on them) will likely work as well.

Dick

---

<div class="post-metadata">

**Author:** ![Prathap\_Dasari](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Prathap\_Dasari](https://forum.ansible.com/u/Prathap_Dasari)\
**Post date:** [December 7, 2020, 3:24pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/14 "2020-12-07T15:24:00Z")

</div>

Ok thank you . Will check a that …

---

<div class="post-metadata">

**Author:** ![tin](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@tin](https://forum.ansible.com/u/tin)\
**Post date:** [December 7, 2020, 6:25pm UTC](https://forum.ansible.com/t/how-to-copy-files-from-src-ansible-controller-to-dest-target-hosts/34288/15 "2020-12-07T18:25:57Z")

</div>

_ssh: connect to host 172.20.8.90 port 22: Connection timed out\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: unexplained error (code 255) at io.c(226)_

This look like a firewall and/or network routing issue. Your laptop can not connect to the remote host, 172.20.8.90 at port 22. Get that working first.

Tin
