win_copy between two network shares

Hi,

I want to copy a file from network share to another network share in ansible.

But the problem is, i can able to pass credential for only one server using runas method.

Need suggestion on this issue. Below is my playbook

[root@ansible wincopy]# cat roles/wincopy/tasks/main.yml

  • name: copy
    win_copy:
    src=“\\192.168.1.168\f\
    test”

dest=“\\192.168.1.55\Soft\test”
remote_src=True
become: yes
become_method: runas
become_flags: logon_type=new_credentials logon_flags=netcredentials_only
vars:
ansible_become_user: Username2
ansible_become_pass: password2

I can only suggest workarounds

You could try creating a common user / password combination on both of the network shares, and use that user for the win_copy task. Its not something I have tried, but it might work.

Otherwise you could split up the transfer and use smbclient to transfer files to your ansible controller and then win_copy them from the controller to the destination share. If the files are large I’d consider using a web server and downloading using win_get_url as for large files this is much faster than win_copy.

Hope this helps,

Jon