# Download a file in control machine and copy to windows host

**URL:** <https://forum.ansible.com/t/download-a-file-in-control-machine-and-copy-to-windows-host/24077>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 28, 2017, 5:46am UTC](https://forum.ansible.com/t/download-a-file-in-control-machine-and-copy-to-windows-host/24077 "2017-03-28T05:46:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [March 28, 2017, 5:46am UTC](https://forum.ansible.com/t/download-a-file-in-control-machine-and-copy-to-windows-host/24077/1 "2017-03-28T05:46:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 28, 2017, 8:39am UTC](https://forum.ansible.com/t/download-a-file-in-control-machine-and-copy-to-windows-host/24077/2 "2017-03-28T08:39:32Z")

</div>

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](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](http://docs.ansible.com/ansible/win_copy_module.html)

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [March 28, 2017, 9:30am UTC](https://forum.ansible.com/t/download-a-file-in-control-machine-and-copy-to-windows-host/24077/3 "2017-03-28T09:30:48Z")

</div>

how can i mention the destination ?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 29, 2017, 11:36am UTC](https://forum.ansible.com/t/download-a-file-in-control-machine-and-copy-to-windows-host/24077/4 "2017-03-29T11:36:40Z")

</div>

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
