vmware_guest error: Unable to access the virtual machine configuration: Unable to access file

1,428 views
Skip to first unread message

Jason B

unread,
Feb 8, 2022, 11:03:52 AM2/8/22
to Ansible Project
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

Code:

```

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 ) ***

Jason B

unread,
Feb 8, 2022, 11:04:58 AM2/8/22
to Ansible Project

Christopher Bachmeyer

unread,
Nov 23, 2022, 2:55:08 PM11/23/22
to Ansible Project
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. 

Rowe, Walter P. (Fed)

unread,
Nov 25, 2022, 6:37:10 AM11/25/22
to ansible...@googlegroups.com
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
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9c8e7c38-8884-4506-9cf7-977dbaeea812n%40googlegroups.com.

Christopher Bachmeyer

unread,
Nov 28, 2022, 12:16:52 PM11/28/22
to Ansible Project
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.  

I hope it is a creds issue though. 

Jason B

unread,
Nov 29, 2022, 8:00:07 AM11/29/22
to Ansible Project
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. 
Reply all
Reply to author
Forward
0 new messages