ansible-collections / community.vmware

Ansible Collection for VMware
GNU General Public License v3.0
346 stars 334 forks source link

Add ESX Host to vCenter failed #1575

Open markusroth1 opened 1 year ago

markusroth1 commented 1 year ago
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
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": "administrator@vsphere.local",
            "validate_certs": false
        }
    },
    "msg": "Failed to add host to vCenter 'vcenter' : ('A specified parameter was not correct: spec.hostName', None)"
}
ansibullbot commented 1 year ago

Files identified in the description: None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help