我正在尝试使用Ansible代码和vmware_host模块将ESX主机添加到vCenter Server。它在认证验证中失败了。对此有什么解决方法吗?
---
- hosts: localhost
tasks:
- name: Add ESXi Host to VCSA
local_action:
module: vmware_host
hostname: xxxxxxxxxx
username: administrator@vsphere.local
password: xxxxx
datacenter_name: Datacenter
cluster_name: cluster1
esxi_hostname: xxxxx
esxi_username: root
esxi_password: xxxx
state: present
这是我的任务的输出:
xxxx@ubuntu:/etc/ansible$ sudo ansible-playbook sample.yml
[WARNING]: provided hosts list is empty, only localhost is available
PLAY ***************************************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [Add ESXi Host to VCSA] ***************************************************
fatal: [localhost -> localhost]: FAILED! => {"changed": false, "failed": true, "msg": "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)"}
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1
答案 0 :(得分:0)
尝试将validate_certs: False
添加到您的任务中:
---
- hosts: localhost
tasks:
- name: Add ESXi Host to VCSA
local_action:
module: vmware_host
hostname: xxxxxxxxxx
username: administrator@vsphere.local
password: xxxxx
datacenter_name: Datacenter
cluster_name: cluster1
esxi_hostname: xxxxx
esxi_username: root
esxi_password: xxxx
state: present
validate_certs: False