# Copying files from vsphere datastore to host

**URL:** <https://forum.ansible.com/t/copying-files-from-vsphere-datastore-to-host/30259>\
**Category:** Ansible Project\
**Created:** [May 3, 2019, 12:25pm UTC](https://forum.ansible.com/t/copying-files-from-vsphere-datastore-to-host/30259 "2019-05-03T12:25:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spongebob33167](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@spongebob33167](https://forum.ansible.com/u/spongebob33167)\
**Post date:** [May 3, 2019, 12:25pm UTC](https://forum.ansible.com/t/copying-files-from-vsphere-datastore-to-host/30259/1 "2019-05-03T12:25:51Z")

</div>

With vsphere\_copy, I can upload files to a vsphere datastore, but I want to download a .vmdk file from a datastore to my local server. Is there an ansible module that will let me download from a datastore?

---

<div class="post-metadata">

**Author:** ![goneri](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/goneri/32/1023_2.png) [@goneri](https://forum.ansible.com/u/goneri)\
**Post date:** [May 3, 2019, 3:14pm UTC](https://forum.ansible.com/t/copying-files-from-vsphere-datastore-to-host/30259/2 "2019-05-03T15:14:09Z")

</div>

spongebob33167 \<mike.s.rose@gmail.com\> writes:

> With vsphere\_copy, I can upload files to a vsphere datastore, but I want to  
> download a .vmdk file from a datastore to my local server. Is there an  
> ansible module that will let me download from a datastore?

Hi Spongebob33167!

You can already browse the /folder end-point with a browser and so use  
the get\_url module:

e.g: [https://192.168.1.40/folder](https://192.168.1.40/folder) on my ESXi returns a listing of the  
datacenter. And I can navigate to finally download a file.

The API documentation:  
[https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.vcli.examples.doc%2FGUID-7675E084-5A80-4517-83B7-6BBC69F8D145.html](https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.vcli.examples.doc%2FGUID-7675E084-5A80-4517-83B7-6BBC69F8D145.html)

Regards,

---

<div class="post-metadata">

**Author:** ![spongebob33167](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@spongebob33167](https://forum.ansible.com/u/spongebob33167)\
**Post date:** [May 3, 2019, 6:54pm UTC](https://forum.ansible.com/t/copying-files-from-vsphere-datastore-to-host/30259/3 "2019-05-03T18:54:24Z")

</div>

Thank you! get\_url works. The tricky part was figuring out the url to the file I wanted.
