Closed
Description
SUMMARY
Add a ESXi host to vcenter failed with error message:
"Failed to add host to vCenter 'vcenter' : ('A specified parameter was not correct: spec.hostName', None)"
ISSUE TYPE
- Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible version: 2.11.8
COLLECTION VERSION
community.vmware: 3.2.0
CONFIGURATION
OS / ENVIRONMENT
RHEL 8.7
STEPS TO REPRODUCE
---
- name: Connect ESX Hosts to VC
hosts: localhost
gather_facts: False
vars_files:
- ../answerfile.yml
tasks:
- name: Add ESXi Hosts to VCSA
vmware_host:
hostname: "{{ vcenter.name }}"
username: "{{ vcenter.user }}"
password: "{{ vcenter.password }}"
datacenter_name: "datacenter"
validate_certs: false
cluster_name: "cluster"
esxi_hostname: "myesxhost"
esxi_username: "root"
esxi_password: "rootpass_of_esx_host"
state: present
delegate_to: localhost
EXPECTED RESULTS
ACTUAL RESULTS
The full traceback is:
File "/tmp/ansible_community.vmware.vmware_host_payload_gv58b2gf/ansible_community.vmware.vmware_host_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_host.py", line 477, in state_add_host
File "/tmp/ansible_community.vmware.vmware_host_payload_gv58b2gf/ansible_community.vmware.vmware_host_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py", line 155, in wait_for_task
raise_from(TaskError(error_msg, host_thumbprint), task.info.error)
File "<string>", line 3, in raise_from
fatal: [localhost -> localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"add_connected": true,
"cluster_name": "cluster",
"datacenter_name": "datacenter",
"esxi_hostname": "myesxhost",
"esxi_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"esxi_ssl_thumbprint": "",
"esxi_username": "root",
"fetch_ssl_thumbprint": true,
"folder": null,
"force_connection": true,
"hostname": "vcenter",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"proxy_host": null,
"proxy_port": null,
"reconnect_disconnected": true,
"state": "present",
"username": "[email protected]",
"validate_certs": false
}
},
"msg": "Failed to add host to vCenter 'vcenter' : ('A specified parameter was not correct: spec.hostName', None)"
}