---
- hosts: all
gather_facts: true
connection: local
vars_files:
- vcenter_creds.yml
- vars.yml
tasks:
- name: Gather vmware host facts from vCenter
community.vmware.vmware_host_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ hostname }}"
validate_certs: no
register: host_facts
delegate_to: localhost
---
- name: Enable SSH on ESXi Hosts
hosts: localhost
connection: local
vars_files:
- vars2.yml
- vcenter_creds.yml
tasks:
- name: Connect to vCenter servers and retrieve ESXi host information
vmware_host:
hostname: "{{ item }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
gather_vm_hosts: yes
gather_nic_info: yes
gather_vswitch_info: yes
register: vmware_info
with_items: "{{ vcenter_servers }}"
TASK [Connect to vCenter servers and retrieve ESXi host information] *********************************************************************************************
failed: [localhost] (item=) => {"ansible_loop_var": "item", "changed": false, "item": "", "msg": "missing required arguments: datacenter_name, esxi_hostname"}
failed: [localhost] (item=) => {"ansible_loop_var": "item", "changed": false, "item": ""msg": "missing required arguments: datacenter_name, esxi_hostname"}