# How should I properly configure inventories that query VMWare vSphere for node information?

**URL:** <https://forum.ansible.com/t/how-should-i-properly-configure-inventories-that-query-vmware-vsphere-for-node-information/25744>\
**Category:** Ansible Project\
**Tags:** vmware, awx\
**Created:** [October 12, 2017, 9:09pm UTC](https://forum.ansible.com/t/how-should-i-properly-configure-inventories-that-query-vmware-vsphere-for-node-information/25744 "2017-10-12T21:09:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [October 12, 2017, 9:09pm UTC](https://forum.ansible.com/t/how-should-i-properly-configure-inventories-that-query-vmware-vsphere-for-node-information/25744/1 "2017-10-12T21:09:29Z")

</div>

Also posted here: [How should I properly configure inventories that query VMWare vSphere for node information? · Issue #386 · ansible/awx · GitHub](https://github.com/ansible/awx/issues/386)

##### SUMMARY

What I want to do is create an inventory of all vm’s on my vSphere that start with “web-”.

I’ve read [http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#vmware-vcenter](http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#vmware-vcenter) and spent several hours experimenting with both smart and regular inventories on my test instance of AWX.

I have been able to create a regular inventory and add a vmware source to it. That source then pulls in every single vm we have. I have not been able to make the vmware source filter out all but the “web-” vm’s.

I’ve been able to create a smart inventory that looks that vmware regular inventory and filters out all but the hosts I want.

Is that how I am supposed to do it?

Information about my setup:

> ```auto
> Docker version 17.09.0-ce, build afdb6d4
> AWX from github, devel branch. Last commit: d02221702fd680cd38068ec49597a7b627228c04
> Installed using the docker instructions.
> 
> ```

Related questions:

- What syntax can I use in the “INSTANCE FILTERS” box when configuring a vmware source?
  - Can I use “\*” as a wildcard?
  - What keys can I filter on? (I did look at [https://github.com/ansible/ansible/blob/devel/contrib/inventory/vmware\_inventory.ini](https://github.com/ansible/ansible/blob/devel/contrib/inventory/vmware_inventory.ini) and [https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.vcenterhost.doc/GUID-2B6A1637-384D-4597-B453-B575F0ECD8A7.html](https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.vcenterhost.doc/GUID-2B6A1637-384D-4597-B453-B575F0ECD8A7.html) but I wasn’t able to figure out how to apply that information…)

- In [https://github.com/ansible/ansible/blob/13e89b17cc8ac3676837608270a88864ff4282cb/contrib/inventory/vmware\_inventory.ini#L101](https://github.com/ansible/ansible/blob/13e89b17cc8ac3676837608270a88864ff4282cb/contrib/inventory/vmware_inventory.ini#L101) there’s something about reducing the data looked up to speed up inventory refreshes. How do I translate that into the variables textarea when configuring my vmware source?
- Same question as the last bullet for “skip\_keys”.

---

<div class="post-metadata">

**Author:** ![Justin\_Redman](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@Justin\_Redman](https://forum.ansible.com/u/Justin_Redman)\
**Post date:** [January 30, 2020, 8:31pm UTC](https://forum.ansible.com/t/how-should-i-properly-configure-inventories-that-query-vmware-vsphere-for-node-information/25744/2 "2020-01-30T20:31:17Z")

</div>

Did you ever figure this out or get a good answer? I’ve ran into the exact same issue, found your post on github also, and I’ve found nothing useful.

---

<div class="post-metadata">

**Author:** ![william.dossett](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@william.dossett](https://forum.ansible.com/u/william.dossett)\
**Post date:** [August 14, 2020, 6:14pm UTC](https://forum.ansible.com/t/how-should-i-properly-configure-inventories-that-query-vmware-vsphere-for-node-information/25744/3 "2020-08-14T18:14:20Z")

</div>

I see this is quite old/stale, however there is no answer to it that I can see… I am trying to use the VMware quick filters and getting no luck with that, however I was able to do something similar to what you are asking for…

I needed all VM names that started with ‘TA - Linux’. I put the following into the inventory/source instance filter field:

{{ “TA - Linux” in config.name }}

and it worked correctly. Hopefully if anyone else is searching this might help them… Now if I could figure out how the quick filters work - I need to try and get all VMs that are of some sort of windows variety in one inventory. I have tried:

{{ “windows” in config.guestfullname }}

but that returns ALL vms… finding any examples of this is difficult - if I had one example that worked I am sure I could work it backwards and figure the whole quick filters thing out…l

I got that config.guestfullname from [https://github.com/ansible/awx/issues/386](https://github.com/ansible/awx/issues/386). but in there at the end with the server variables, I don’t see config.name! I imagine this is something stupid I am not following but if anyone sees this, I am still looking!

---

<div class="post-metadata">

**Author:** ![Paul\_Manno](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/paul_manno/32/2804_2.png) [@Paul\_Manno](https://forum.ansible.com/u/Paul_Manno)\
**Post date:** [September 3, 2020, 3:12pm UTC](https://forum.ansible.com/t/how-should-i-properly-configure-inventories-that-query-vmware-vsphere-for-node-information/25744/4 "2020-09-03T15:12:25Z")

</div>

Hi all,

So I too am struggling with this, but I do have some things working to some degree.

Environment Details:  
AWX Version: AWX 14.1.0  
VCenter Server Version: 6.7.0  
ESXi Host Versions: VMware ESXi, 6.0.0, 10719132

Pretty much the only field in the Source to use is the “Source Variables” field. In there I have the following:
