Using groupby_custom_field_excludes with the vmware inventory script

Hello !

I’m working with the vmware inventory script, in the vmware_inventory.ini i’m trying to use the “groupby_custom_field_excludes” filter but i can’t make it work, i didnt found examples on google, do you have some examples to give me ?

i’m already using custom_field_group_prefix with success and the value of groupby_custom_field is set to True.

Thanks for your help

Awx vendors (copy and paste at a point in time) a copy of ansible’s dynamic inventory. We do this because we know it to work with the dependencies that we pin (i.e. boto version for aws or shade version for openstack). Therefore, the feature set of the vendored version may be behind upstream releases of ansible.

With that in mind, in looking at awx vendored version we see custom_field_group_prefix in VMware inventory code here https://github.com/ansible/awx/search?utf8=✓&q=custom_field_group_prefix&type=
In searching the code I don’t find any results for groupby_custom_field_excludes.

Now let’s try and find this feature in Ansible. After some googling I see that PR 36877 added support for the feature your looking for! https://github.com/ansible/ansible/pull/36877 From the PR tags we can see that it affects ansible 2.6 so let’s go to the 2.6 branch.

Hmm I wasn’t able to find the changes in the 2.6 branch, but here it is in the 2.7 branch! https://github.com/ansible/ansible/blob/stable-2.7/contrib/inventory/vmware_inventory.py

Now we need to get this script into tower. Easiest way is to upload it as a custom inventory script. How do we do that exactly? Well thankfully the paid product version of awx, Ansible Tower, comes with great documentation and is available for FREE to you! https://docs.ansible.com/ansible-tower/latest/html/administration/custom_inventory_script.html

Note: On a plane when I wrote this, with way too much time. Your welcome.

Many Thanks for all this information, it was just not working because i didnt take the last vmware_inventory.py script available,

For my needs it works perfectly configuring it this way (just the key, not the value): groupby_custom_field_excludes=“com.emc.avamar.vmware.snapshot”