Skip to content

Concourse Resource for AWX Job Templates and Workflow Job Templates

License

Notifications You must be signed in to change notification settings

mamercad/concourse-awx-resource

Repository files navigation

Concourse AWX Resource

Shell Python

A Concource CI custom resource for Ansible AWX. Docker images are named quay.io/mamercad/concourse-awx-resource:<version> and can be viewed here, the Dockerfile is in the root of this repository.

Currently, the resource supports launching AWX Job Templates and Workflow Job Templates.

There's a Makefile which may help:

❯ make help
help:  Shows this help
build:  Build the Docker images
push:  Push the Docker images
run:  Run the (local) Docker image
ping:  Test AWX connectivity and access
validate:  Validate the pipeline
set:  Set the pipeline
unpause:  Unpause the pipeline
launch:  Launch the pipeline
shipit: build push set launch  Build, push, set and launch

There's also a infra/Makefile which may help for local development, see the infra/README.md.

Resource Configuration

awx.endpoint: The API endpoint of the AWX instance. Follows the same pattern as the AWX API or CLI, e.g., https://your.tower.tld. Note the lack of the trailing lash, and, don't provide /api/v2.

awx.auth: The authentication context, both Bearer <oauth_token> and Basic <base64_user_colon_pass> should work.

Resource Behavior

check: No-op.

in: No-op.

out: Launches either the job template or the workflow job template, polling it until completion.

Parameters

awx.type: (Required) Currently supports either job_templates and workflow_job_templates. The name is plural, but, the behavior is singular (keeping parity with the API terminology).

awx.id: (Required) The ID of the job template or workflow job template to launch.

awx.debug: (Optional, default is false) Controls whether or not to enable additional debugging information.

Example Pipeline

resource_types:
  - name: awx-workflow-resource
    type: docker-image
    source:
      repository: quay.io/mamercad/concourse-awx-resource
      version: 0.0.1

resources:
  - name: awx
    type: awx-workflow-resource
    source:
      awx:
        endpoint: ((TOWER_HOST))
        auth: Bearer ((TOWER_OAUTH_TOKEN))

jobs:
  - name: awx-job
    plan:
      - put: awx
        params:
          awx:
            type: job_templates
            id: ((TOWER_JOB_TEMPLATES))
            debug: false
      - put: awx
        params:
          awx:
            type: workflow_job_templates
            id: ((TOWER_WORKFLOW_JOB_TEMPLATES))
            debug: false

Screenshot

All of the job results will be returned, here's a screenshot to give you a feel:

Screenshot of Concourse AWX Resource

License

MIT © Mark Mercado <mamercad@gmail.com>