hi All
I have one external application, which is much easier GUI interface for less experience engineers, compare to the much more complexity of AWX GUI.
Basically this application is using Python towerlib (GitHub - schubergphilis/towerlib: A python library to interface with ansible tower's (awx) api.) to send the HTTP request to AWX to execute a AWX template. AWX will return the output of template executed to this application.
Most of my templates are running fine, but I have some templates which can’t be executed from this application successfully.
- I have AWX template A and B, both are the same inventory and the same credential, the same Team (group).
- Both A and B can be executed successfully when directly executed from AWX GUI, run by the same user.
- Template A can be executed successfully from my own application to AWX. But Template B can’t be executed from my own application towards AWX, and with Debug in Chrome, it seems that AWX is returning ‘Invalid template’ to my application.
The detailed JSON format data returned by AWX
//Success of template A
{
"id": 1585,
"options": [
{
"argument": {
"id": 493,
"awx_argument_name": "dest_ip",
"multi_select": false,
"argument_type": "text",
"validation": "ip",
"dropdowns": [],
"max_length": 100,
"required": true
},
"value": "8.8.8.8"
}
],
"jobs": [
{
"id": 1438,
"hosts": [
{
"awx_host_id": 48,
"hostname": "test.test.net"
}
],
"inventory": {
"id": 10,
"awx_inventory_id": 3,
"name": "Production_Monboxes"
},
"awx_job_id": 1010,
"status": "Unknown",
"stdout": null,
"created_at": null,
"finished_at": null
}
],
"finished": false,
"download_hash": "b973526b176b336df735d765c7a91733",
"created_at": "2023-12-22T08:28:14.281440Z",
"total_execution_time": null,
"template": {
"id": 1,
"noc_groups": [
{
"awx_group_id": 2,
"name": "QNOC"
},
{
"awx_group_id": 1,
"name": "NOC"
}
],
"arguments": [
{
"id": 493,
"awx_argument_name": "dest_ip",
"multi_select": false,
"argument_type": "text",
"validation": "ip",
"dropdowns": [],
"max_length": 100,
"required": true
},
{
"id": 494,
"awx_argument_name": "count",
"multi_select": false,
"argument_type": "text",
"validation": "dec",
"dropdowns": [],
"max_length": 100,
"required": false
},
{
"id": 495,
"awx_argument_name": "quiet",
"multi_select": false,
"argument_type": "dropdown",
"validation": "",
"dropdowns": [
{
"value": "-q"
}
],
"max_length": 100,
"required": false
}
],
"inventories": [
{
"id": 10,
"awx_inventory_id": 3,
"name": "Production_Monboxes"
}
],
"name": "Tshoot - Arping",
"awx_template_id": 44,
"created_at": "2022-03-11T09:47:46.364763Z",
"created_by": 1
},
"created_by": {
"first_name": "Test",
"last_name": "Test"
}
}
//Fail of template B
{
"id": 1590,
"options": [
{
"argument": {
"id": 588,
"awx_argument_name": "dest_ip",
"multi_select": false,
"argument_type": "text",
"validation": "ip",
"dropdowns": [],
"max_length": 100,
"required": true
},
"value": "8.8.8.8"
}
],
"jobs": [
{
"id": 1443,
"hosts": [
{
"awx_host_id": 48,
"hostname": "test.test.net"
}
],
"inventory": {
"id": 10,
"awx_inventory_id": 3,
"name": "Production_Monboxes"
},
"awx_job_id": null,
"status": "Invalid template",
"stdout": null,
"created_at": null,
"finished_at": null
}
],
"finished": false,
"download_hash": "c02f529f7fc083d6ddf78cfe37dc3320",
"created_at": "2023-12-22T08:53:52.265769Z",
"total_execution_time": null,
"template": {
"id": 43,
"noc_groups": [
{
"awx_group_id": 2,
"name": "QNOC"
},
{
"awx_group_id": 1,
"name": "NOC"
}
],
"arguments": [
{
"id": 588,
"awx_argument_name": "dest_ip",
"multi_select": false,
"argument_type": "text",
"validation": "ip",
"dropdowns": [],
"max_length": 100,
"required": true
}
],
"inventories": [
{
"id": 10,
"awx_inventory_id": 3,
"name": "Production_Monboxes"
}
],
"name": "Tshoot - Ping",
"awx_template_id": 20,
"created_at": "2023-12-11T13:02:21.405041Z",
"created_by": 7
},
"created_by": {
"first_name": "Test",
"last_name": "Test"
}
}
You can see that for the success one, AWX returns an ‘awx_job_id’, but for the failed ones, AWX returns ‘Invalid template’
Any suggestion
- Under what condition will AWX return a ‘Invalid template’ ?
- Is there anyway I can check a bit more logs related to the whole execution process ? When a template can be called in AWX, I know we can find more logs by changing Verbosity level of the template. But in this case, the template can’t be even called in AWX