-2

I use Ansible win_copy module to copy files from my Linux machine to my Windows server and it requires quite a lot of time (about 6 seconds an empty file).

An picure of my Ansible playbook is linked.

Does anyone know how to improve the win_copy speed? Or should I use other ways to copy files from Linux to Windows?

I tried to use a list of small tasks on each file instead of loop function but it didn't change anything.

U880D
  • 8,601
  • 6
  • 24
  • 40
Iga21207
  • 3
  • 1

2 Answers2

0

According the documentation win_copy module – Copies files to remote locations on windows hosts - Notes

Because win_copy runs over WinRM, it is not a very efficient transfer mechanism. If sending large files consider hosting them on a web service and using ansible.windows.win_get_url instead.

Regarding

I'm trying to send a few empty files. Is that the same issue?

the latency comes from the fact that you are looping over a list of files causing opening and closing a connection for one file after the other. This is adding significant overhead and time to your task.

An apporach to avoid this is to ZIP the files and transmit them in one step and as mentioned in the other answer here.

U880D
  • 8,601
  • 6
  • 24
  • 40
  • Yes, I've seen that but it says about large files and I'm trying to send a few empty files. Is that the same issue? – Iga21207 Jun 30 '23 at 12:10
0

Consider zipping the files thus doing only one call to win_copy if win_get_url is not practical for your usecase.

U880D
  • 8,601
  • 6
  • 24
  • 40
The_Pingu
  • 169
  • 6