ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.06k stars 3.42k forks source link

API call that returns inventory objects associated with nested workflow templates/jobs #10603

Open Ladas opened 3 years ago

Ladas commented 3 years ago
ISSUE TYPE
SUMMARY

Catalog needs API call that returns all associated Inventory objects with a workflow, namely:

  1. List all inventory objects of job_templates nested under workflow template
  2. List all inventory objects of jobs nested under workflow job

We'd need this done in one API call, so this information would have to be most likely pre-computed/cached on Controller side

wenottingham commented 3 years ago

Depending on page size, you'll need mutliple calls for pagination.

You can do this today with 2 (+ any pagination) calls for a workflow job template N via:

Similarly for a workflow job run N:

cc @shanemcd @matburt

chrismeyersfsu commented 3 years ago

https://example.tower.server.com/api/v2/inventories/?jobs__unified_job_node__workflow_job=71293

OR to build on what @wenottingham said

/api/v2/workflow_jobs/N/workflow_nodes/?inventory__isnull=false <-- will filter out some results for you.

Ladas commented 3 years ago

@wenottingham @chrismeyersfsu does this return all descendants or just children of the workflow? I remember we needed to do a recursive query (so a query for each children that is a nested workflow), to get all descendants, because the API didn't support his.