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

Also posted here: 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 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:

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

Related questions:

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.

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. 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!

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: