I have the following json output in ansible:
[{
"active_transaction": null,
"cores": 4,
"hostname": "alpha-auth-wb01"
},
{
"active_transaction": null,
"cores": 4,
"hostname": "beta-auth-wb01"
}]
Now I am trying to filter the output to just show the output where the hostname contains alpha for example.
Output should be:
[{
"active_transaction": null,
"cores": 4,
"hostname": "alpha-auth-wb01"
}]
Code and results:
jq: "[?contains(hostname, 'alpha')]"
fatal: [worker.domain]: FAILED! => {"msg": "JMESPathError in json_query filter plugin:\\nIn function contains(), invalid type for value: None, expected one of: ['array', 'string'], received: \\"null\\""}
Also tried adding from_json | to_json and the other way around. Still fails.
Any ideas much appreciated!