AWX container help

Hi,

I am running AWX as a container, version 13…

I have come across an issue whereby filtering on a VMware source for inventory doesn’t work in AWX 13, but it does work in the most recently released version of Ansible Tower.

I was having some difficulty finding the filter I needed to use - this article helped me to identify the variable name I was looking for:

https://access.redhat.com/solutions/2986421

this involves downloading a python script and ini file and running those – but in Tower, it is a venv, so I was able to activate it, download the scripts and run them to find all of the variable names to filter on in VMware.

The one I needed was:

Instance Filters field in the Source: {{ “Linux” in config.guestfullname }}

This allowed me to filter just Linux hosts for my inventory.

This same exact syntax does not work in awx13. Instead it retrieves ALL hosts in the vmware vcenter…

So I would like to follow the redhat solution and run this script against AWX13 to see the filter variables that I can use… but I don’t know how to do that in a docker image… can anyone point me in the right direction or any docs, anything that would help me out with this? Docker isn’t currently one of my strong points – I know it should be…

Regards

Bill

Ok, so I figured out how to get a shell in the container, created my vmware_inventory.ini and .py and ran the file and the keypair I am looking at is there, the same as in Ansible Tower, however it does not work. It always returns all VMs, never filters them…

I guess I open an issue? unless anyone else knows more about this…

thanks
Bill

AWX doesn’t use file base ini like tower does. What you want to do is modify the python script so that it can get the credentials that it need from environmental variables. Basically if the env exists use them instead of parsing the ini file. Then you want to do something like this (https://averytechguy.com/2018/10/22/add-custom-dynamic-inventory-in-ansible-tower-servicenow/ ) in AWX. The example above it for getting info from servicenow via python in awx. Setting up a credentials in awx that provides the env needed by the python script. If you look at the python script it provides a mechanism to get the credentials from env as well as ini.

Michael