Download a file in control machine and copy to windows host

Hi,
I want to download files from an URL to control machine and store them in it and copy them over to windows host. How can we achieve this in single playbook

Use ‘get_url’ module to fetch the file onto your ansible controller (with 'delegate_to: localhost so that uri runs on the ansible machine, not your play hosts. See http://docs.ansible.com/ansible/get_url_module.html

Then use win_copy to copy from wherever you downloaded it to on your controller, to wherever you want it on your windows host. See http://docs.ansible.com/ansible/win_copy_module.html

Hope this helps,

Jon

how can i mention the destination ?

I am not sure I understand your question. Maybe some more details about what you need to achieve would help others make suggestions?

get_url has a ‘dest’ parameter, which would need to be a location on your ansible controller
win_copy also has a ‘dest’ parameter, but this would be the final location you want the file to arrive on your windows machines.

The documentation for each module and examples should help to understand this…

Jon