---
title: Get the status of an Ansible job
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/ansible/ansible-job-getstatus
---

This page provides a reference for the `ansible.job.getStatus` action available in the workflow automation actions catalog. Use this action to poll a job created by [`ansible.job.launch`](https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/ansible/ansible-job-launch) until it reaches a terminal state.

For prerequisites, see [Ansible job actions](https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/ansible/ansible-job#prerequisites).

## Get the status of an Ansible job

The action identifier is `ansible.job.getStatus`.

Gets the status and details of an Automation Controller job. Job statuses progress from `pending` to `waiting` to `running` before reaching a terminal state: `successful`, `failed`, `error`, or `canceled`. The endpoint is `GET https://{host}/api/controller/v2/jobs/{jobId}/`.

### Inputs

The following table describes all available input fields for this action.

| Input         | Type   | Description                                                                                | Example                                                                                      |
| ------------- | ------ | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **host**      | String | **Required.** Hostname (and optional port) of the Automation Controller, without scheme.   | `${{ :secrets:host }}`                                                                       |
| **authToken** | String | **Required.** OAuth2 token sent as `Authorization: Bearer <token>`.                        | `${{ :secrets:ansibleControllerToken }}`                                                     |
| **jobId**     | Int    | **Required.** Numeric job ID to poll. Typically the `id` returned by `ansible.job.launch`. | `128`                                                                                        |
| **selectors** | List   | **Optional.** JQ selectors to extract specific fields from the action output.              | `[{"name": "status", "expression": ".status"}, {"name": "failed", "expression": ".failed"}]` |

### Outputs

The following table describes all output fields returned by this action.

| Output           | Type    | Description                                                                                                                                                                                                             |
| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **success**      | Boolean | `true` on success, `false` on failure.                                                                                                                                                                                  |
| **response**     | Object  | Job details from the Automation Controller API. ```json {   "id": 128,   "status": "successful",   "failed": false,   "started": "2026-07-08T10:00:00Z",   "finished": "2026-07-08T10:02:13Z",   "elapsed": 133.0 } ``` |
| **errorMessage** | String  | Error message on failure. `null` on success.                                                                                                                                                                            |

### Example

The following example polls an Ansible job and branches on the result.

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: check-ansible-job description: Fetch the status of a previously launched Ansible job steps:   - name: get_status     type: action     action: ansible.job.getStatus     version: 1     inputs:       host: ${{ :secrets:host }}       authToken: ${{ :secrets:ansibleControllerToken }}       jobId: "128"       selectors:         - name: status           expression: ".status"         - name: failed           expression: ".failed"     next: end ``` |
