From 3d0ef80ac8304344c5239c6d0f9182b8c61654d0 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 17 Jul 2025 22:31:59 +0200 Subject: [PATCH] chore(awx): extend on workflows --- knowledge base/awx.md | 33 ++++++++++++++++++++++++++++++++- snippets/ansible/awx.fish | 25 +++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/knowledge base/awx.md b/knowledge base/awx.md index 5e90e2c..9ad82fe 100644 --- a/knowledge base/awx.md +++ b/knowledge base/awx.md @@ -900,7 +900,38 @@ _Workflow Job Templates_ coordinate the linking and execution of multiple resour - Running Jobs based on the success or failure of one or more previous Jobs. - Requesting an admin's approval to proceed with one or more executions. -Each action is a _node_ on a Workflow Job Template, and allows visualizing the flow of actions. +Each action is a _node_ on a Workflow Job Template. + +
+Creation process + +```mermaid +flowchart LR + job_template("Job Template") + playbook("Playbook") + project("Project") + workflow_job_template("Workflow Job Template") + workflow_node("Workflow Node") + + playbook --> project --> job_template --> workflow_node --> workflow_job_template +``` + +All the playbooks used in the workflow must be visible to AWX, meaning that one or more projects containing them must be +already configured in the instance. + +Workflows need nodes to refer. Nodes reference a job template, which in turn refer a playbook to run. + +The AWX UI does not allow creating nodes directly, but it can be done via the visualizer. + +1. Open _Resources_ > _Templates_ in the sidebar. +1. Click on the _Add_ button and choose _Add job template_ to add every job template that is needed.
+ Repeat as required. +1. Click on the _Add_ button and choose _Add workflow template_. +1. Fill in the form with the resources all nodes should share, and _save_.
+ The visualizer will open. +1. In the visualizer, create the needed nodes. + +
## API diff --git a/snippets/ansible/awx.fish b/snippets/ansible/awx.fish index 9d949cc..1857743 100644 --- a/snippets/ansible/awx.fish +++ b/snippets/ansible/awx.fish @@ -57,3 +57,28 @@ awx projects update --monitor --interval '3' '4' # list schedules awx schedules list --all | jq '.results[].name' + +### +# Workflows +# -------------------------------------- +### + +# list workflow job templates +awx workflow_job_templates list --all | jq '.results[].name' + +# show info about workflow job templates +awx workflow_job_templates get '28' +awx workflow get 'Restore DEV DBs' --conf.format 'jq' --filter '.id' + +# list workflow job nodes +awx workflow_job_nodes list +awx workflow_job_nodes list --all | jq '.results[].identifier' + +# show info about workflow job nodes +awx workflow_job_nodes get '33' + +# list workflow job template nodes +awx workflow_job_template_nodes list --all | jq '.results[].name' + +# show info about workflow job template nodes +awx workflow_job_template_nodes get '3'