# Ansible Create vSphere Virtual Machine

**URL:** <https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252>\
**Category:** Ansible Project\
**Created:** [February 17, 2020, 3:48pm UTC](https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252 "2020-02-17T15:48:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [February 17, 2020, 3:48pm UTC](https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252/1 "2020-02-17T15:48:30Z")

</div>

Ansible playbook fails to deploy Virtual Machine: Can’t Find Folder  
How can I deploy a Virtual machine without any Folders within the Cluster ?

---

<div class="post-metadata">

**Author:** ![Jorge\_Rua1](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Jorge\_Rua1](https://forum.ansible.com/u/Jorge_Rua1)\
**Post date:** [February 17, 2020, 3:52pm UTC](https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252/2 "2020-02-17T15:52:39Z")

</div>

Try with :  
folder: “{{ yourfolder | d (‘/’) }}”

---

<div class="post-metadata">

**Author:** ![Joao\_Santos](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@Joao\_Santos](https://forum.ansible.com/u/Joao_Santos)\
**Post date:** [February 17, 2020, 4:05pm UTC](https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252/3 "2020-02-17T16:05:45Z")

</div>

Hi David

It’s a good pratice that you are able to identify uniqueness of the virtual machine and folder will help you to achieve that.

You already have an answer before that might help you out to achieve what you’re requesting (no folders).  
Nevertheless check here [https://github.com/js-max/ansible-vmware-new-vm](https://github.com/js-max/ansible-vmware-new-vm), might help you to speed up things if need to.

Cheers

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [February 17, 2020, 4:06pm UTC](https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252/4 "2020-02-17T16:06:11Z")

</div>

For everyone else that is wondering what the 'd' filter is, it's an  
alias for 'default' 🙂

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [February 17, 2020, 5:04pm UTC](https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252/5 "2020-02-17T17:04:54Z")

</div>

> When i Enter the virtualMachine Name \_ Folder I’m getting the following

No Folder /TESTMACHINE match in search path…

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [February 17, 2020, 7:29pm UTC](https://forum.ansible.com/t/ansible-create-vsphere-virtual-machine/32252/6 "2020-02-17T19:29:04Z")

</div>

Ok I’m using just / as the folder seems to be bypassing that now

but not sure what could be causing the following:: fatal: [localhost → localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to create a virtual machine : Unable to access the virtual machine configuration: Unable to access file [vsanDatastore] /win10-template.vmtx”}
