Dear Alex,

For your output minimisation:
you can arrange your task like this:

- name: Collect list of VMs in cluster
  community.vmware.vmware_vm_info:
     validate_certs: false
  register: vm_list

- name: Print list
  ansible.builtin.debug:
     msg: "{{ item['guest_name'] }}"
  loop: "{{ vm_list.virtual_machines }}"
    loop_control:
     label:  "Collected vm-name"  # either you put empty string or some
relevant string



output will be like this:

ok: [localhost] => (item=Collected vm-name)
    msg": "server01"
ok: [localhost] => (item=Collected vm-name)
    msg": "server02"
ok: [localhost] => (item=Collected vm-name)
    msg": "server03"

no more unwanted text during the debug for each iteration:
eg.  (item={'guest_name': 'xxxxxx', 'guest_fullname': 'Microsoft Windows
Server 2022 (64-bit)', 'power_state': 'poweredOn', 'ip_address': 'xxxxxx',
'mac_address': ['xxxxxx'], 'uuid': 'xxxxxx', 'instance_uuid': 'xxxxxx',
'vm_network': {'xxxxxx': {'ipv4': ['xxxxxx'], 'ipv6': []}},
'esxi_hostname': 'xxxxxx', 'datacenter': 'xxxxxx', 'cluster': 'xxxxxx',
'resource_pool': None, 'attributes': {}, 'tags': [], 'folder': 'xxxxxx',
'moid': 'xxxxxx', 'datastore_url': [{'name': 'xxxxxx', 'url': 'xxxxxx'}],
'allocated': {}}) =>

I hope this helps


Regards
Nitesh Dudhe

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGPd1LmKTJvoB5b3sWauUa6KBFpUKPVUTbPLkqBsC2KKdoYhGw%40mail.gmail.com.

Reply via email to