Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing AWX workflow jobid information #170

Closed
ronrem opened this issue Apr 26, 2024 · 13 comments
Closed

Missing AWX workflow jobid information #170

ronrem opened this issue Apr 26, 2024 · 13 comments

Comments

@ronrem
Copy link

ronrem commented Apr 26, 2024

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
Screenshot 2024-04-26 at 15 11 39

I require the Jobid for an AWX artifact lookup.

Thank you for your assistance.
Regards
Ronald

@ronrem
Copy link
Author

ronrem commented Apr 26, 2024

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)

@ansibleguy76
Copy link
Owner

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.

@ronrem
Copy link
Author

ronrem commented Apr 26, 2024

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

@ansibleguy76
Copy link
Owner

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"
  }
}

@ansibleguy76
Copy link
Owner

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.

@ronrem
Copy link
Author

ronrem commented Apr 27, 2024

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.

@ansibleguy76
Copy link
Owner

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.

@ronrem
Copy link
Author

ronrem commented Apr 27, 2024

Get your point, it would be very helpful if you store the AWX jobid in a unique key/value combination!

@ronrem
Copy link
Author

ronrem commented May 3, 2024

What is the current status? Are you waiting for me, or am I waiting for you?

@ansibleguy76
Copy link
Owner

I know enough... You can expect a new version soon

@ansibleguy76
Copy link
Owner

will be available in 5.0.2... beta coming

@ansibleguy76
Copy link
Owner

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)

@ansibleguy76
Copy link
Owner

I will close this... ping me if you think it should not be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants