Would like to create a list of servers that have and do not have an application installed. Basically a compose a value that says true if application is installed and false if not based on the guestinfo.appInfo list.
Example value from guestinfo.appInfo
- key: guestinfo.appInfo
value: |-
{
“version”:“1”,
“updateCounter”:“1455”,
“publishTime”:“2022-05-18T05:18:18.491Z”,
“applications”:[
{“a”:“coreServiceShell.exe”,“v”:“6.1.0.6161”},
{“a”:“dns.exe”,“v”:“10.0.14393.4283”},
{“a”:“svchost.exe”,“v”:“10.0.14393.0”},
{“a”:“winlogbeat.exe”,“v”:“”},
{“a”:“snowagent.exe”,“v”:“6.7.2.0”},
{“a”:“winlogon.exe”,“v”:“10.0.14393.3204”},
{“a”:“conhost.exe”,“v”:“10.0.14393.0”},
{“a”:“[System Process]”,“v”:“”}]}
I was hoping to be able to assign this to a value to a compose variable that is true or false. Tested with some thing simple that I know works:
has_ip: ‘true if guest.net.0.network is defined else false’
This correctly sets has_ip to true or false. But cant quite seem to even assign the whole list from guestinfo.appInfo, later on filter on it.
compose:
ansible_host: ‘guest.ipAddress’
app_list: ‘guestinfo.appInfo’
How can I list guestinfo.appInfo. Tried several things, pipe to flatten and list and resync but I don’t manage to get the variable to be assigned.
Am I approaching this the wrong way? Perhaps creating a playbook to define custom facts and update the host facts is the more Ansible way of going about this?
Any input is much appreciated!