# dynamic inventory

**URL:** <https://forum.ansible.com/t/dynamic-inventory/26039>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [November 15, 2017, 6:28pm UTC](https://forum.ansible.com/t/dynamic-inventory/26039 "2017-11-15T18:28:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arpanmeda93](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@arpanmeda93](https://forum.ansible.com/u/arpanmeda93)\
**Post date:** [November 15, 2017, 6:28pm UTC](https://forum.ansible.com/t/dynamic-inventory/26039/1 "2017-11-15T18:28:10Z")

</div>

Is there a way for dynamic inventory in vmware environmnet. Can we use the tags of VMs to do dynamic invetory in ansible.  
Any example would help. Thanks.  
Meda.

---

<div class="post-metadata">

**Author:** ![countryroad62](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@countryroad62](https://forum.ansible.com/u/countryroad62)\
**Post date:** [November 16, 2017, 9:06pm UTC](https://forum.ansible.com/t/dynamic-inventory/26039/2 "2017-11-16T21:06:02Z")

</div>

I’ve been using the vmware\_inventory.py inventory script.

The current vmware\_inventory.py script uses pyVmomi. The pyVmomi API doesn’t support “tags” because that information is in a different database than where that API can currently query (as it was explained to me). You can use custom attributes though and you would need to set the max\_object\_level=2 or higher to see them.

---

<div class="post-metadata">

**Author:** ![countryroad62](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@countryroad62](https://forum.ansible.com/u/countryroad62)\
**Post date:** [November 16, 2017, 9:15pm UTC](https://forum.ansible.com/t/dynamic-inventory/26039/3 "2017-11-16T21:15:50Z")

</div>

For examples on how to use a local inventory script, see the online docs: [http://docs.ansible.com/ansible/latest/intro\_dynamic\_inventory.html](http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html)
