Open
Description
SUMMARY
As stated in the title trying to deploy a VM using a Cluster where a node is in maintenance mode could result in a failure.
ISSUE TYPE
- Bug Report
COMPONENT NAME
- community.vmware.vmware_guest
ANSIBLE VERSION
ansible [core 2.16.14]
config file = /config/.ansible.cfg
configured module search path = ['/config/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /config/venv_python/lib/python3.12/site-packages/ansible
ansible collection location = /config/.ansible/collections:/usr/share/ansible/collections
executable location = /config/venv_python/bin/ansible
python version = 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0] (/config/venv_python/bin/python3)
jinja version = 3.1.5
libyaml = True
COLLECTION VERSION
Collection Version
----------------- -------
community.general 9.5.0
community.vmware 4.7.0
STEPS TO REPRODUCE
Given a Datacenter with a Cluster of 3 nodes, simply put 2 nodes in maintenance mode and run the the playbook as seen in invocation.module_args
Each ESXi host has only local datastore:
ESXi 1 -> ds_171 # maintenance mode
ESXi 2 -> ds_172
ESXi 3 -> ds_173 # maintenance mode
ACTUAL RESULTS
As you can see ds_173 (which is the local datastore of the node in maintence) is not found because it was selected a node which was in maintenance mode.
{
"msg": "Failed to create a virtual machine : Unable to access the virtual machine configuration: Unable to access file [ds_173]",
"invocation": {
"module_args": {
"hostname": "vcenterdmz.ad.XXXXX.it",
"name": "PIPPO",
"annotation": "Name: ubuntu-24-04-amd64 - Version: 2025.05 - Built on: 2025-05-08 08:17 UTC\n\nAWX Job 375044",
"folder": "PAPERINO",
"datacenter": "DatacenterPluto",
"cluster": "ClusterPluto",
"template": "/DatacenterPluto/vm/PAPERINO/ubuntu-24-04-amd64",
"disk": [
{
"size_gb": 50,
"type": "thin",
"autoselect_datastore": true,
"controller_number": null,
"controller_type": null,
"datastore": null,
"disk_mode": null,
"filename": null,
"size": null,
"size_kb": null,
"size_mb": null,
"size_tb": null,
"unit_number": null
}
],
"hardware": {
"memory_mb": 2048,
"num_cpus": 2,
"num_cpu_cores_per_socket": 2,
"hotadd_cpu": true,
"hotremove_cpu": true,
"boot_firmware": null,
"cpu_limit": null,
"cpu_reservation": null,
"hotadd_memory": null,
"vpmc_enabled": null,
"max_connections": null,
"mem_limit": null,
"cpu_shares_level": null,
"mem_shares_level": null,
"cpu_shares": null,
"mem_shares": null,
"mem_reservation": null,
"memory_reservation_lock": null,
"nested_virt": null,
"scsi": null,
"secure_boot": null,
"version": null,
"virt_based_security": null,
"iommu": null
},
"networks": [
{
"ip": "192.168.1.1",
"name": "VLAN_Y",
"netmask": "255.255.255.0",
"gateway": "192.168.1.254",
"type": "static",
"connected": true,
"typev6": "dhcp"
}
],
"customization": {
"hostname": "PIPPO.ad.XXXXX.it",
"dns_servers": [
"8.8.8.8",
"1.1.1.1"
],
"dns_suffix": [
"ad.XXXXX.it"
],
"autologon": null,
"autologoncount": null,
"domain": null,
"domainadmin": null,
"domainadminpassword": null,
"existing_vm": null,
"fullname": null,
"hwclockUTC": null,
"joindomain": null,
"joinworkgroup": null,
"orgname": null,
"password": null,
"productid": null,
"runonce": null,
"script_text": null,
"timezone": null
},
"state": "poweredon",
"validate_certs": false,
"wait_for_ip_address": true,
"wait_for_ip_address_timeout": 300,
"advanced_settings": [
{
"key": "disk.enableuuid",
"value": "TRUE"
}
],
"username": "username@ad.XXXXX.it",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"is_template": false,
"customvalues": [],
"name_match": "first",
"use_instance_uuid": false,
"nvdimm": {
"size_mb": 1024,
"state": null,
"label": null
},
"cdrom": [],
"encryption": {
"encrypted_vmotion": null,
"encrypted_ft": null
},
"force": false,
"state_change_timeout": 0,
"linked_clone": false,
"wait_for_customization": false,
"wait_for_customization_timeout": 3600,
"vapp_properties": [],
"delete_from_inventory": false,
"proxy_host": null,
"proxy_port": null,
"uuid": null,
"guest_id": null,
"esxi_hostname": null,
"snapshot_src": null,
"resource_pool": null,
"customization_spec": null,
"datastore": null,
"convert": null
}
},
"_ansible_no_log": false,
"changed": false,
"_ansible_delegated_vars": {
"ansible_host": "localhost",
"ansible_port": null,
"ansible_user": "ansible_ldap",
"ansible_connection": "local"
}
}
EXPECTED RESULTS
The module should not only find the datastore, but should also exclude a ESXi host if it's in maintenance mode
Metadata
Metadata
Assignees
Labels
No labels