From the following json resonse I want to get all the "displayName" values where in the "tags" no key containing "Support Team" is present.
In this case I would expect "Apache Web Server" as an answer.
"msg": "JMESPathError in json_query filter plugin:\nIn function contains() expected one of: ['array', 'string'], received: "object"
[
{
"entityId": "PROCESS_GROUP_INSTANCE-16CA2E1741B16EF7",
"displayName": "Apache Web Server ",
"discoveredName": "Apache Web Server ",
"firstSeenTimestamp": 1624209179999,
"lastSeenTimestamp": 1634576939999,
"tags": [
{
"context": "CONTEXTLESS",
"key": "Apache - HTTP Server",
"value": "Apache Web Server "
},
{
"context": "CONTEXTLESS",
"key": "Description",
"value": "vcc_genesys_mcp_b_[prd]"
},
{
"context": "CONTEXTLESS",
"key": "Host",
"value": "xx.xx.xx.x,"
}
],
"fromRelationships": {
"isProcessOf": [
"HOST-C2B40BEA8D1EDEAF"
],
"isInstanceOf": [
"PROCESS_GROUP-D47E25FDCCAFB058"
]
},
"toRelationships": {},
"metadata": {
"commandLineArgs": [
"/usr/sbin/httpd -V"
],
"executables": [
"httpd"
],
"executablePaths": [
"/usr/sbin/httpd"
]
},
"softwareTechnologies": [
{
"type": "APACHE_HTTPD",
"edition": null,
"version": "2.4.6"
}
],
"bitness": "64bit",
"monitoringState": {
"actualMonitoringState": "OFF",
"expectedMonitoringState": "ON",
"restartRequired": false
}
},
{
"entityId": "PROCESS_GROUP_INSTANCE-56E5C00FAE04F9F3",
"displayName": "Apache Web Server WebOfficeApache",
"discoveredName": "Apache Web Server WebOfficeApache",
"firstSeenTimestamp": 1619099280000,
"lastSeenTimestamp": 1634709180000,
"tags": [
{
"context": "CONTEXTLESS",
"key": "Apache - HTTP Server",
"value": "Apache Web Server WebOfficeApache"
},
{
"context": "CONTEXTLESS",
"key": "Application",
"value": "VCC - Genesys - GWT"
},
{
"context": "CONTEXTLESS",
"key": "Description",
"value": "vcc_genesys_gwt_d_[prd]"
},
{
"context": "CONTEXTLESS",
"key": "Host",
"value": "xx.xx.xx.xx,"
},
{
"context": "CONTEXTLESS",
"key": "Support Team - TIO Contact Center Support"
}
],
"fromRelationships": {
"isProcessOf": [
"HOST-751FB31157FE2887"
],
"isInstanceOf": [
"PROCESS_GROUP-23FA731EF9FAD174"
]
},
"metadata": {
"commandLineArgs": [
"httpd -k start -f /opt/genesys/gcti/WebOfficeApache/httpd.conf -DFOREGROUND"
],
},
"softwareTechnologies": [
{
"type": "APACHE_HTTPD",
"edition": null,
"version": "2.4.6"
}
],
"listenPorts": [
8080
],
"bitness": "64bit",
"modules": [
"mod_auth_basic.c",
],
"monitoringState": {
"actualMonitoringState": "ON",
"expectedMonitoringState": "ON",
"restartRequired": true
},
"agentVersions": [
{
"major": 1,
"minor": 221,
"revision": 131,
"timestamp": "20210727-144835",
"sourceRevision": ""
}
],
"managementZones": [
{
"id": "3595395043409676188",
"name": "VCC - Genesys - GWT"
},
{
"id": "7589108031829358004",
"name": "VCC"
}
]
},
...
]
Playbook:
- name: List all configured auto-tags
uri:
url: "https://xx.xx-xx.xx{{ prd_env }}api/v1/entity/infrastructure/process-groups?includeDetails=true"
method: GET
headers:
Content-Type: application/json; charset=utf-8
Authorization: "{{ prd_auth }}"
return_content: yes
register: data_tags_prd
- name: Print all configured auto-tags
debug:
var: data_tags_prd.json
- debug:
msg: "{{ data_tags_prd.json | json_query(query) }}"
vars:
query: "[?!contains(@, 'Support team').displayName]"
data_tags_prd.json | to_json | from_json | json_query(query)and it will work