Ansible AWX - Launching a Job Template

There are 2 options to trigger a Job Template.

  1. via the UI 2. via the RESTful API

Triggering a Job Template from the UI

  • Navigate to the Job Template to run, then click on Launch

  • Next, the console output will be displayed showing you the progress of the playbook.

Triggering a Job Template from the RESTful API

Ansible AWX provides a RESTful API to programmatically interact with the platform.

This is accessible via: http://localhost/api/v2/

To trigger a specific Job Template.

Navigate to:

/api/v2/job_templates/

This will show a list of Job Templates currently available within Ansible AWX.

You will notice each Job Template has a project associated with it, and this will give you an idea on which Job Template to launch.

In this example I have the following project

  "project": 
    { 
      "id": 10, "name": "DiskChecker", "description": "", "status": "ok", "scm_type": ""
    }

Find the specific launch entry in the JSON, is the unique ID of the Job Template

    "launch": "/api/v2/job_templates/<ID>/launch/"

When you open the link it will take you to a page to invoke a HTTP POST action.

If the particular Job Template requires extra variables to run, then these can be sent via the {} content.

  "extra_vars": {
          "key": "val"
  }

Once ready, click on the POST button to trigger the Job Template.

You can then track the progress of the triggered Job Template via the UI under Jobs.

You can also track the progress via API using the Job stdout.

/api/v2/jobs/<job_no>/stdout/

Last updated on 28 Feb 2020
Published on 28 Feb 2020