Thanks, Nitesh...!
I now have a much cleaner printout!

Alex

On Wed, Aug 21, 2024 at 1:56 AM Nitesh Dudhe <niteshdudh...@gmail.com>
wrote:

> 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
> <https://groups.google.com/d/msgid/ansible-project/CAGPd1LmKTJvoB5b3sWauUa6KBFpUKPVUTbPLkqBsC2KKdoYhGw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 



[image: Edmonton_sig_RGB_S.jpg]

Alex Wanderley

Application and Infrastructure Analyst II
Server Solutions & Automation

Financial and Corporate Services | Open City and Technology



780-496-4156  Office

780-819-0273  Mobile



City of Edmonton

Century Place, 19th Floor

9803 102A Avenue NW

Edmonton AB, T5J 3A3



All information contained in this email post is proprietary to the City of
Edmonton, confidential and intended only for the addressed recipient. If
you have received this post in error, please disregard the contents, inform
the sender of the misdirection, and remove it from your system. The
copying, dissemination or distribution of this email, if misdirected, is
strictly prohibited.

-- 
*The contents of this message and any attachment(s) are confidential, 
proprietary to the City of Edmonton, and are intended only for the 
addressed recipient. If you have received this in error, please disregard 
the contents, inform the sender of the misdirection, and remove it from 
your system. The copying, dissemination, or distribution of this message, 
if misdirected, is strictly prohibited.*

-- 
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/CADp8UUS374t6n3-Bjs37RCUHU4CzaPkDdQDgEVNgXi2Q79ke%2BA%40mail.gmail.com.

Reply via email to