connect to multiple vcenters and esxi hosts without host file

I got this pb but it is only working for single vcenter and I have to put the esxi hosts into a host file.

Is it possible to connect to multiple vcenters and lookup all the esxi hosts and connect to them instead of using host file?

vars.yml

vcenter_hostname: vcenter1.domain.com
hostname: “{{ inventory_hostname }}”

vcenter_creds.yml has my credentials and I run the pb with --ask-vault-pass

Here is something I tried

please use vmware_vm_facts: module, it will collect all info connected to vmware, from there you can filter ESX names.

it will collect for all vcenter mentioned in your var2.yml file.

Ravi
yoursmartbook.blogspot.com