Member-only story
Copy files to Windows remote hosts — Local to Remote — Ansible module win_copy
How to copy report.txt file to Windows remote hosts using Ansible module win_copy.
How to copy files to Windows remote hosts?
I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot
Ansible copy files to Windows remote hosts
Today we’re talking about Ansible module win_copy.
The full name is `ansible.windows.win_copy` which means is part of the collection of modules “ansible.windows” targeted windows remote hosts.
This module is pretty stable and out for years.
The purpose is to copy files from the local machine to remote locations.
Because win_copy runs over WinRM, it is not a very efficient transfer mechanism. If you plan to send large files consider hosting them on a web service and using `ansible.windows.win_get_url` instead.
Please note that the opposite is done by module win_fetch.
On Linux target use the module `ansible.builtin.copy`.