# Need help parsing output from VMware collection

**URL:** <https://forum.ansible.com/t/need-help-parsing-output-from-vmware-collection/2714>\
**Category:** Get Help\
**Tags:** vmware, playbook, collections\
**Created:** [December 4, 2023, 1:06am UTC](https://forum.ansible.com/t/need-help-parsing-output-from-vmware-collection/2714 "2023-12-04T01:06:01Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![newbie](https://avatars.discourse-cdn.com/v4/letter/n/dc4da7/32.png) [@newbie](https://forum.ansible.com/u/newbie)\
**Post date:** [December 4, 2023, 1:06am UTC](https://forum.ansible.com/t/need-help-parsing-output-from-vmware-collection/2714/1 "2023-12-04T01:06:01Z")

</div>

I’m trying to use the community.vmware collection to automate the creation of a number of VMs (fine with that bit), where I am coming unstuck is parsing the output of community.vmware.vmware\_datastore\_info

“datastores”: [  
{  
“name”: “datastore1”,  
“summary”: {  
“\_vimtype”: “vim.Datastore.Summary”,  
“accessible”: true,  
“capacity”: 119990648832,  
“datastore”: “vim.Datastore:656bd379-a008a098-6ed8-d05099c155c9”,  
“freeSpace”: 84916830208,  
“maintenanceMode”: null,  
“multipleHostAccess”: null,  
“name”: “datastore1”,  
“type”: “VMFS”,  
“uncommitted”: 3793282394,  
“url”: “/vmfs/volumes/656bd379-a008a098-6ed8-d05099c155c9”  
}  
},  
{  
“name”: “datastore2”,  
“summary”: {  
“\_vimtype”: “vim.Datastore.Summary”,  
“accessible”: true,  
“capacity”: 239981297664,  
“datastore”: “vim.Datastore:656bd392-48951fa8-1f7f-d05099c155c9”,  
“freeSpace”: 238469251072,  
“maintenanceMode”: null,  
“multipleHostAccess”: null,  
“name”: “datastore2”,  
“type”: “VMFS”,  
“uncommitted”: 0,  
“url”: “/vmfs/volumes/656bd392-48951fa8-1f7f-d05099c155c9”  
}  
}  
]

```auto
---
# find free space on cluster datastores
- name: Retrieve information on free space in each datastore
  community.vmware.vmware_datastore_info:
    hostname: "{{ '<host>>' }}"
    username: "{{ 'root' }}"
    password: "{{ '<password>>' }}"
    validate_certs: False
    schema: vsphere
    properties:
      - name
      - summary
  delegate_to: localhost
  register: info

- name: datastore info output
  ansible.builtin.debug:
    msg="{{ info }}"
# msg="{{ info | type_debug}}"

```

So the output is of type “dict” but I can’t seem identify the correct syntax to extract the fields i want from the output. I want to extract the datastore name and the available free space to evaluate whether I have enough free space to deploy on that datastore (make sense?).

Can someone who knows what their doing point me the in the right direction, or offer some example code?

I tried using _map_ to pull the relevant fields but I can’t make this work, there is a gap in my understanding…

---

_[View the full topic](https://forum.ansible.com/t/need-help-parsing-output-from-vmware-collection/2714)._
