# vmware\_guest error: Unable to access the virtual machine configuration: Unable to access file

**URL:** <https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [February 8, 2022, 4:03pm UTC](https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304 "2022-02-08T16:03:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_B](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Jason\_B](https://forum.ansible.com/u/Jason_B)\
**Post date:** [February 8, 2022, 4:03pm UTC](https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304/1 "2022-02-08T16:03:52Z")

</div>

SUMMARY

When attempting to provision a new vmware VM using the vmware\_guest module to VSAN storage, I am getting the following error:

`msg": "Failed to create a virtual machine : Unable to access the virtual machine configuration: Unable to access file [some_other_non_vsan_storage_cluster_not_connected_to_ESXI_Cluster] Linux_Base_Template/Linux_Base_Template.vmtx".`

Same problem documented in: Ansible Issue: 28649 — I have attempted the fix that is documented there by added a disk section ( see above ) with the datastore variable ( we have many datastores ). The templates live on a separate storage system NOT connected to ESXi Clusters that are configured for VSAN. \* This works perfectly by manually cloning via vCenter to the target ESXi Cluster. \* This works perfectly if I am provisioning to ESXi clusters that have the "[some\_other\_non\_vsan\_storage\_cluster\_not\_connected\_to\_ESXI\_Cluster] " connected to it. \* This works perfectly by executing vmware powercli NEW-VM command here is the code for that: [https://thesleepyadmins.com/2018/09/08/deploy-multiple-vms-using-powercli-and-vmware-template](https://thesleepyadmins.com/2018/09/08/deploy-multiple-vms-using-powercli-and-vmware-template)

Code:

```auto

msg": "Failed to create a virtual machine : Unable to access the virtual machine configuration: Unable to access file [some_other_non_vsan_storage_cluster_not_connected_to_ESXI_Cluster] Linux_Base_Template/Linux_Base_Template.vmtx". "invocation": { "module_args": { "name": "TMPBLDLNXLL0001", "hostname": "vCenterServer", "username": "XXXXXXXXXX", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "annotation": "Test VSAN provisioning", "template": "Linux-8_Base_Template", "datacenter": "devnulldc", "folder": "devnulldc/vm/Sandbox", "cluster": "CL-03", "disk": [{ "size_gb": 50, "type": "thin", "datastore": "['vSAN']", "autoselect_datastore": null, "controller_number": null, "controller_type": null, "disk_mode": null, "filename": null, "size": null, "size_kb": null, "size_mb": null, "size_tb": null, "unit_number": null } ], "hardware": { "num_cpus": 2, "memory_mb": 4096, "num_cpu_cores_per_socket": 2, "hotadd_cpu": false, "hotremove_cpu": false, "hotadd_memory": false, "nested_virt": false, "scsi": "paravirtual", "boot_firmware": null, "cpu_limit": null, "cpu_reservation": null, "max_connections": null, "mem_limit": null, "mem_reservation": null, "memory_reservation_lock": null, "secure_boot": null, "version": null, "virt_based_security": null, "iommu": null }, "networks": [ { "name": "BlackholeNet", "type": "static", "ip": "987.65.43.21", "netmask": "255.255.255.0", "gateway": "987.65.43.1", "device_type": "vmxnet3", "dvswitch_name": "vDSwitch", "start_connected": true } ***Truncated***

```

\*\* Note obviously I have masked a lot of information ( like IP address, etc ) \*\*\*

---

<div class="post-metadata">

**Author:** ![Jason\_B](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Jason\_B](https://forum.ansible.com/u/Jason_B)\
**Post date:** [February 8, 2022, 4:04pm UTC](https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304/2 "2022-02-08T16:04:57Z")

</div>

Forgot to mention I have a issue opened here: [vmware\_guest error: Unable to access the virtual machine configuration: Unable to access file · Issue #1201 · ansible-collections/community.vmware · GitHub](https://github.com/ansible-collections/community.vmware/issues/1201)

---

<div class="post-metadata">

**Author:** ![Chris\_Bachmeyer](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@Chris\_Bachmeyer](https://forum.ansible.com/u/Chris_Bachmeyer)\
**Post date:** [November 23, 2022, 7:55pm UTC](https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304/3 "2022-11-23T19:55:08Z")

</div>

Did you find a resolution to this by chance?

I just ran into the issue when I changed datastores. I was using a general datastore holding templates but the goal was to use the same datastore of the Content library and use those templates.

“msg”: “Failed to create a virtual machine : Unable to access the virtual machine configuration: Unable to access file [\<datastore\_name\>] W2K19\_STD/W2K19\_STD.vmtx”}

Thanks.

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [November 25, 2022, 11:36am UTC](https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304/4 "2022-11-25T11:36:44Z")

</div>

This sounds like a datastore permissions issue within VMware related to the user ID you are using with the module. When we build our server provisioning workflow we had to create a special user ID for provisioning and grant it specific rights with VMware so it could do the things needed on the proper datastores, create VMs, manage networks, etc.

Walter

---

<div class="post-metadata">

**Author:** ![Chris\_Bachmeyer](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@Chris\_Bachmeyer](https://forum.ansible.com/u/Chris_Bachmeyer)\
**Post date:** [November 28, 2022, 5:16pm UTC](https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304/5 "2022-11-28T17:16:52Z")

</div>

Thanks, Walter. I am going to check on this. I too had established a specific service account with all of the necessary rights for vSphere provisioning. It’s quite possible  
something was missed regarding the datastore holding the content library.

I did find this issue too which indicates the Python pyvmomi library may not have support for the Content Library.  
[https://github.com/ansible/ansible/issues/37007](https://github.com/ansible/ansible/issues/37007)

I hope it is a creds issue though.

---

<div class="post-metadata">

**Author:** ![Jason\_B](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Jason\_B](https://forum.ansible.com/u/Jason_B)\
**Post date:** [November 29, 2022, 1:00pm UTC](https://forum.ansible.com/t/vmware-guest-error-unable-to-access-the-virtual-machine-configuration-unable-to-access-file/36304/6 "2022-11-29T13:00:07Z")

</div>

The “solution” I ended up implementing is a work around. I simply put the template on the VSAN datastore - and named it something like [template]-vsan. And added logic, so that template would be referenced when the vsan datastore was selected. This has been working for me for months now.
