DebugFactor.com | Forum

How to copy or download a file from a windows share path to another windows server using ansible

I need to copy a file from a windows share to the target server. Is there a module in ansible to copy from windows share path?

Yes, you can use the win_copy module. Similar to normal file copy in windows, this works for copy from the windows share path as well. Just provide the location in the src field.

Make sure the windows share path is accessed using a credential that has access to the share or a password less connection is established.

Please try as below.

- name: Copy files
  win_copy:
   src: '\\WINSERVERNAME\apps\test.xml'
   dest: 'C:\temp\'
   remote_src: yes