Copy files from windows machine to linux machine using ansible

I trying to copy files from a remote windows machine to my local machine(linux machine) using ansible. As fetch module works for linux to linux file transfer, is there anything similar that could enable me to fetch files from windows machine to linux machine?

Fetch can also fetch from windows machines back to your ansible controller machine.

If you are fetching from > 1 windows box don’t forget to fetch to a directory, or use something like {{ inventory_hostname_short }} when generating the file name.

Hope this helps,

Jon

I tried the following playbook:

I did some changes and it worked. But, the whole directory is getting created on the linux machine which has the desired file.

I used flat=yes and the issue is now resolved. Thank you!

Can you tell me what are the changes you made

This ought to do it (not tested).

Jon

But this won’t run and there’s no error,

If you can share the error we may be able to help, my thoughts are the delegate_to isn’t needed and the src path is inavlid but without any more info we can’t really help.