Hi Folks,
I need your help here, how can i get all hostnames (marked) to print. when i try msg: “{{results.json.actions[0].system.hostname}}” and msg: “{{results.json.actions[1].system.hostname}}” it prints me the two hosts, but i need all hosts availble in single msg – tried this --msg: “{{results.json.actions[*].system.hostname}}” not working. i am still confused in getting info from json can some one give me good link to learn about this.
I used URI module to fetch this info:
ok: [localhost] => {
“msg”: {
“cache_control”: “no-cache”,
“changed”: false,
“connection”: “close”,
“content_length”: “2220”,
“content_type”: “application/json; charset=utf-8”,
“cookies”: {
“a5442528c5a688d4fb7fca696f6ac395”: “d19de2f36ad8eea0b2f80509777960b8”
},
“cookies_string”: “a5442528c5a688d4fb7fca696f6ac395=d19de2f36ad8eea0b2f80509777960b8”,
“date”: “Thu, 15 Aug 2019 15:12:22 GMT”,
“etag”: “"8ac-julM1vkItyH51OY7TzLhAe1ha1o"”,
“failed”: false,
“json”: {
“actions”: [
{
“current_report”: {
“details”: {},
“id”: 1409219514
},
“done”: false,
“id”: 760010,
“maintenance_id”: 44153,
“rule”: {
“ansible”: true,
“ansible_fix”: true,
“ansible_mitigation”: false,
“category”: “Security”,
“description”: “Kernel with loaded modules vulnerable to denial of service via Bluetooth stack (CVE-2017-1000251/Blueborne)”,
“description_html”: “
Kernel with loaded modules vulnerable to denial of service via Bluetooth stack (CVE-2017-1000251/Blueborne)
\n”,“id”: “CVE_2017_1000251_kernel_blueborne|KERNEL_CVE_2017_1000251_LOADED_DOS”,
“node_id”: “3177271”,
“reboot_required”: true,
“rec_impact”: 3,
“rec_likelihood”: 4,
“severity”: “ERROR”
},
“system”: {
“display_name”: null,
“hostname”: “",
“isCheckingIn”: true,
“last_check_in”: “2019-08-15T00:20:08.000Z”,
“remote_branch”: “98d1a60f-f62c-4039-a604-19bee8adc0b0”,
“remote_leaf”: “7636906c-a11b-4988-ade2-5f43d233bb75”,
“system_id”: “765884e3-381b-45f4-8780-2377c7bf1a35”,
“system_type_id”: 105,
“toString”: "”
}
},
{
“current_report”: {
“details”: {},
“id”: 1409403783
},
“done”: false,
“id”: 760011,
“maintenance_id”: 44153,
“rule”: {
“ansible”: true,
“ansible_fix”: true,
“ansible_mitigation”: false,
“category”: “Security”,
“description”: “Kernel with loaded modules vulnerable to denial of service via Bluetooth stack (CVE-2017-1000251/Blueborne)”,
“description_html”: “
Kernel with loaded modules vulnerable to denial of service via Bluetooth stack (CVE-2017-1000251/Blueborne)
\n”,“id”: “CVE_2017_1000251_kernel_blueborne|KERNEL_CVE_2017_1000251_LOADED_DOS”,
“node_id”: “3177271”,
“reboot_required”: true,
“rec_impact”: 3,
“rec_likelihood”: 4,
“severity”: “ERROR”
},
“system”: {
“display_name”: null,
“hostname”: “",
“isCheckingIn”: true,
“last_check_in”: “2019-08-15T03:44:41.000Z”,
“remote_branch”: “98d1a60f-f62c-4039-a604-19bee8adc0b0”,
“remote_leaf”: “97ddbbbb-9bd9-4a1a-b1a0-a92a95bd2663”,
“system_id”: “9b72e8d7-4b86-4cf6-9bae-688a04a5a2b3”,
“system_type_id”: 105,
“toString”: ""
}
}
],
“allow_reboot”: true,
“created_by”: “cert-system-658772”,
“description”: null,
“end”: null,
“hidden”: false,
“maintenance_id”: 44153,
“name”: "****************”,
“overdue”: false,
“remote_branch”: “98d1a60f-f62c-4039-a604-19bee8adc0b0”,
“silenced”: false,
“start”: null,
“suggestion”: null
},
“msg”: “OK (2220 bytes)”,
“redirected”: false,
“set_cookie”: “a5442528c5a688d4fb7fca696f6ac395=d19de2f36ad8eea0b2f80509777960b8; path=/; HttpOnly; Secure”,
“status”: 200,
“url”: “https://access.redhat.com/r/insights/v3/maintenance/44153”,
“vary”: “Accept-Encoding”,
“x_request_id”: “14975d50-bf6f-11e9-9524-1d45a1f7c0df”,
“x_rh_insightsapi_host”: “insights-api-310-7dhtg”
}
}
PLAY RECAP *************************************************************************************************************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0