I’m trying to create smart inventory based on facts that ansible has already collected, however any of the searches I construct result either in empty set or deemed to be broken by Tower. Some sample searches:
another note: I don't have facts caching, but browsing API I can see
values of interest in "variables" which seems to be an escaped JSON
string, so I'm not 100% sure how to un-escape it for search.
I couldn’t get the exact API where I can use it for collecting each variable information for each hosts. However, you can create filter something like this to get Linux VM’s through smart inventory by choosing the key information as ’ variables:linux ’
I couldn't get the exact API where I can use it for collecting each
variable information for each hosts. However, you can create filter
something like this to get Linux VM's through smart inventory by
choosing the key information as ' variables:linux '
just tried:
variables:RedHat
0 results, which is impossible as my entire fleet has 'osfamily:RedHat'
in variables. I'm definitely not using things right but which ones and
how should I use them? Documentation is rather scarce on subject.
Those values should be exist under variables json inorder to work.
If filtering works for finding Linux VM’S through the key as ‘variables:linux’ instead of Redhat, we can have our playbook to point out only to the Redhat mahines where the play should run. That can be easily mapped through ‘when’ statement using role based deployment . But, that’s another work around by going through an extra step since couldnt get a API call to filter out each objects under varaiables json.
osfamily:RedHat has been used as an example in my case. I have other
custom facts that should work in a similar fashion but do not. So, to
recap: searching for very standard "osfamily:RedHat" produces no result,
neither is search for some "custom_fact:custom_value" . I have been
working around this in playbook with when clause, but that means that
"Smart Inventories" are a broken feature for me (or I'm not educated
enough to use it).