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

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

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

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

Hi Prathap,

Maybe this will help?
https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html

Ho Ida ,

Thank you , I will try and share the result

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:/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

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?

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

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

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

Still not enough information.
What is the actual problem?

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

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

Ok thank you . Will check a that …

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