Launch Ansible Job Template

Action ID: ansible:jobTemplate:launch
NPM Package:

@kiwigdc/backstage-plugin-scaffolder-backend-module-kawx

Description

Run an Ansible job and wait for it to complete

Input Schema

No input schema defined for this action.

Output Schema

PropertyTypeDescriptionRequired
jobobjectInformation for the job

Usage Examples

Deploy a service to staging using a job template ID and extra variables

Launches a specific Ansible job template to deploy a service to staging. Use this when you have a fixed job template in AWX or Ansible Tower and need to pass runtime variables like image tag and release SHA.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: https://github.com/example-org/service-template
      targetPath: ./service
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: deploy-with-ansible
    action: ansible:jobTemplate:launch
    input:
      jobTemplateId: 42
      extraVars:
        app_name: ${{ parameters.name }}
        environment: staging
        image_tag: ${{ parameters.version }}
        release_sha: ${{ parameters.commitSha }}

  - id: log-deploy-job
    action: debug:log
    input:
      message: |
        Ansible job ${{ steps['deploy-with-ansible'].output.job.id }} completed
  • Prepares project files with fetch:template then runs the Ansible job and logs the resulting job ID with debug:log.

Configure a cluster with nested extra variables and parameterized template ID

Runs a parameterized job template with structured extra variables to configure a cluster. Use this when the job requires complex input like nested dictionaries and lists.

Copy
steps:
  - id: scaffold-infra
    action: fetch:template
    input:
      url: https://github.com/example-org/infra-bootstrap-template
      targetPath: ./infra
      values:
        environment: ${{ parameters.environment }}

  - id: configure-cluster
    action: ansible:jobTemplate:launch
    input:
      jobTemplateId: ${{ parameters.ansibleJobTemplateId }}
      extraVars:
        cluster:
          name: ${{ parameters.clusterName }}
          region: us-east-1
          node_groups:
            - name: web
              count: 3
            - name: worker
              count: 2
        maintenance_window: "2025-02-01T02:00:00Z"
        requested_by: ${{ user.entity.metadata.name }}

  - id: log-configure-job
    action: debug:log
    input:
      message: |
        Configure job ${{ steps['configure-cluster'].output.job.id }} started for cluster ${{ parameters.clusterName }}
  • Sets up initial files with fetch:template, launches the Ansible job with nested extraVars, and logs the job ID using debug:log.