Closed ronrem closed 4 months ago
Just to be complete: I need to fetch AWX JobID number: 54784
mysql> select * from job_output WHERE job_id = 70;
+------+--------------------------------------------------------------------------------------+---------------------+-------------+--------+-------+
| id | output | timestamp | output_type | job_id | order |
+------+--------------------------------------------------------------------------------------+---------------------+-------------+--------+-------+
| 1727 | ful | 2024-04-26 13:03:05 | stdout | 70 | 344 |
| 1728 | Successfully completed template Palo Alto Networks PAN-OS - Swiss Armyknife workflow | 2024-04-26 13:03:05 | stdout | 70 | 345 |
+------+--------------------------------------------------------------------------------------+---------------------+-------------+--------+-------+
2 rows in set (0.00 sec)
the database is incremental about the output. so i can make timestamps. use rest ap to the output. you can add a flag to get text with colourcodes.
The API endpoint "/api/v1/job/70" doesn't have this full job output/jobid. It was available before, lost track of the working version. Link
This output is from the API /api/v1/job/100 in my case.
{
"status": "success",
"message": "job ran successfully",
"data": {
"id": 100,
"form": "test",
"target": "test",
"status": "success",
"start": "2024-04-25T15:20:33.000Z",
"end": "2024-04-25T15:20:43.000Z",
"user": "admin",
"user_type": "local",
"job_type": "awx",
"extravars": "{\"name\":\"vm1\",\"datacenter\":\"dc1\",\"cluster\":\"cluster1\",\"ansibleforms_user\":{\"username\":\"admin\",\"id\":1,\"type\":\"local\",\"groups\":[\"local/admins\"],\"roles\":[\"public\",\"admin\"]},\"__template__\":\"HelloWorld\",\"__credentials__\":{}}",
"credentials": "{}",
"notifications": "{}",
"approval": null,
"step": null,
"parent_id": null,
"subjobs": null,
"no_of_records": 72,
"counter": 20,
"output": "Launched template HelloWorld with jobid 3601\r\n[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the \r\ncontroller starting with Ansible 2.12. Current version: 3.6.8 (default, Sep 10 \r\n2021, 09:13:53) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]. This feature will be\r\nremoved from ansible-core in version 2.12. Deprecation warnings can be disabled\r\n by setting deprecation_warnings=False in ansible.cfg.\r\n[WARNING]: Found variable using reserved name: name\r\n\r\nPLAY [Hello World!] ************************************************************\r\n\r\nTASK [Gathering Facts] *********************************************************\r\nok: [localhost]\r\n\r\nTASK [Hello World!] ************************************************************\r\nchanged: [localhost]\r\nPLAY RECAP *********************************************************************\r\nlocalhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0\r\nSuccessfully completed template HelloWorld"
}
}
I could extend the database with the awx job id, if that helps ? if so, please create a feature request so i can follow up.
This is my full API endpoint "/api/v1/job/70" output, looks like the first AnsibleForms message does not get properly saved in the DB:
{
"status": "success",
"message": "job ran successfully",
"data": {
"id": 70,
"form": "My first form",
"target": "My first form",
"status": "success",
"start": "2024-04-26T12:59:40.000Z",
"end": "2024-04-26T13:03:05.000Z",
"user": "admin",
"user_type": "local",
"job_type": "awx",
"extravars": "{ [truncated] }",
"credentials": "{}",
"notifications": "{}",
"approval": null,
"step": null,
"parent_id": null,
"subjobs": null,
"no_of_records": 22,
"counter": 346,
"output": "<span class=''>ful</span> <span class='tag is-info is-light'>2024-04-26 13:03:05</span>\r\n<span class=''>Successfully completed template My first Workflow</span> <span class='tag is-info is-light'>2024-04-26 13:03:05</span>"
}
}
I was expecting the same output as you provided.
AWX is not providing incremental output. That means I need to remove the overlap between 2 output, I do this to provide timestamps and visualize the progress. With native ansible, I get actual incremental output, so that's easy, there is no overlap. Sometimes AWX changes the output slightly and I miss the overlap, and that sometimes results in double output, I try to be smart and fix potential issues when that occurs. but you issue is having less output, I haven't seen that one before. Very strange indeed. if I store the AWX jobid, at least you could extract it from there then.
Get your point, it would be very helpful if you store the AWX jobid in a unique key/value combination!
What is the current status? Are you waiting for me, or am I waiting for you?
I know enough... You can expect a new version soon
will be available in 5.0.2... beta coming
new beta is now being pushed. use image ":beta" instead of ":latest". And use ctrl-F5 to clear the browser cache. let me know the outcome (awx_id is available in both database and api call)
I will close this... ping me if you think it should not be closed
Hi,
When initiating an AWX Job Template or AWX Workflow Job Template, ansibleforms displays:
Launched template My first Workflow with jobid 54784 2024-04-26 12:59:42
Upon completion of the job, ansibleforms displays:
ful 2024-04-26 13:03:05 Successfully completed template My first Workflow 2024-04-26 13:03:05
It seems that the 'jobid' information is not retained. Even in the job-log, no details about the job are available. However, upon querying the database, the following information is found:
{ "output": "ful", "result_after": "ful" }, { "output": "Successfully completed template My first Workflow", "result_after": "workflow" }
The job log resembles this
I require the Jobid for an AWX artifact lookup.
Thank you for your assistance. Regards Ronald