---
- hosts: localhost
connection: local
gather_facts: false
vars:
vcenters:
- vc1
- vc2
- vc3
vcenter_username: "admini...@vsphere.local"
vcenter_password: "password"
tasks:
- name: Gather all registered virtual machines
community.vmware.vmware_vm_info:
hostname: '{{ item }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: False
delegate_to: localhost
register: myvm
with_items: '{{ vcenters }}'
- name: debug
debug:
msg: "{{ myvm }}"