Ansible AWX - RESTful API

The Ansible AWX API comes with a variety of endpoints to work with AWX programmatically.

In this post I shall explain how I used Python to launch a Job template in AWX via the API.

Endpoints

All API endpoints can be found under the root:

<awx_host>/api/<version>

A HTTP GET returns the list of endpoints (at the time of writing API v2 is the current version).

    {
       "ping":"/api/v2/ping/",
       "instances":"/api/v2/instances/",
       "instance_groups":"/api/v2/instance_groups/",
       "config":"/api/v2/config/",
       "settings":"/api/v2/settings/",
       "me":"/api/v2/me/",
       "dashboard":"/api/v2/dashboard/",
       "organizations":"/api/v2/organizations/",
       "users":"/api/v2/users/",
       "projects":"/api/v2/projects/",
       "project_updates":"/api/v2/project_updates/",
       "teams":"/api/v2/teams/",
       "credentials":"/api/v2/credentials/",
       "credential_types":"/api/v2/credential_types/",
       "credential_input_sources":"/api/v2/credential_input_sources/",
       "applications":"/api/v2/applications/",
       "tokens":"/api/v2/tokens/",
       "metrics":"/api/v2/metrics/",
       "inventory":"/api/v2/inventories/",
       "inventory_scripts":"/api/v2/inventory_scripts/",
       "inventory_sources":"/api/v2/inventory_sources/",
       "inventory_updates":"/api/v2/inventory_updates/",
       "groups":"/api/v2/groups/",
       "hosts":"/api/v2/hosts/",
       "job_templates":"/api/v2/job_templates/",
       "jobs":"/api/v2/jobs/",
       "job_events":"/api/v2/job_events/",
       "ad_hoc_commands":"/api/v2/ad_hoc_commands/",
       "system_job_templates":"/api/v2/system_job_templates/",
       "system_jobs":"/api/v2/system_jobs/",
       "schedules":"/api/v2/schedules/",
       "roles":"/api/v2/roles/",
       "notification_templates":"/api/v2/notification_templates/",
       "notifications":"/api/v2/notifications/",
       "labels":"/api/v2/labels/",
       "unified_job_templates":"/api/v2/unified_job_templates/",
       "unified_jobs":"/api/v2/unified_jobs/",
       "activity_stream":"/api/v2/activity_stream/",
       "workflow_job_templates":"/api/v2/workflow_job_templates/",
       "workflow_jobs":"/api/v2/workflow_jobs/",
       "workflow_approvals":"/api/v2/workflow_approvals/",
       "workflow_job_template_nodes":"/api/v2/workflow_job_template_nodes/",
       "workflow_job_nodes":"/api/v2/workflow_job_nodes/"
    }

For more information see: https://docs.ansible.com/ansible-tower/2.3.0/html/towerapi/intro.html#introduction-to-the-tower-api

Last updated on 5 Mar 2020
Published on 5 Mar 2020