Skip to main content

Prerequisites

The connector should already be set up, with a Connector Profile and a Linked Account. See Getting Started on the Ansible connector page.

Set up the webhook in Ansible

Ansible sends events through a webhook notifier that you create in Ansible Automation Platform and switch on for an organization. StackOne does not create it for you.

1

Copy the Native Webhook URL

The Native Webhook URL is generated once an account has been linked.

  • Open the linked account in StackOne.
  • Copy the value from Native Webhook URL.
2

Open the notifiers page

In Ansible Automation Platform, use a user who can create notifiers in the organization whose events you want.

  • In the navigation, open Automation Execution, then Administration, then Notifiers.
  • Click Create notifier.
The Notifiers page with the Create notifier button highlighted
3

Create the notifier

Fill in the notifier. Ansible sends events for the job templates, workflow templates, projects and inventory sources of the organization you pick.

  • Name: enter a name such as StackOne Integration.
  • Organization: select the organization whose events you want.
  • Notification type: select Webhook
  • Target URL: paste the Native Webhook URL you copied from StackOne.
  • HTTP method: select POST
  • To receive events from a second organization, create a notifier there with the same URL and message bodies.
The Create notifier form with Name, Organization, Notification type, Target URL and HTTP method highlighted
4

Turn on custom messages

On the same form, turn on Customize messages. Ansible then shows one box for each message body. Leave Start message body, success message body and Error message body unchanged. If you customize them, keep them as JSON with the job id, status, started and finished.

The Customize messages switch turned on, with the message body boxes shown under it
5

Set the workflow approval message bodies

Paste one body into each workflow approval box, then click Save notifier. Each body must be valid JSON and must contain two fields. The first is event with the exact value shown for that box, which StackOne reads to tell the four events apart. The second is approval set to {{ job_metadata }}, from which StackOne takes the approval ID and the event date.

The other fields in these bodies are optional. You can remove them or add fields of your own, and StackOne passes them through in the event data.

Workflow approved body

Workflow denied message body

Workflow pending message body

Workflow timed out message body

The four workflow approval message body boxes filled in and highlighted
6

Turn on the notifier for the organization

Ansible sends only the groups that are switched on, so turn on all four for the notifier you created.

  • In the navigation, open Access Management, then Organizations, and click the organization.
  • Open the Notifications tab and find your notifier.
  • Turn on Approval, Start, Success and Failure.
The Notifications tab of an organization with the Approval, Start, Success and Failure switches turned on

Available webhook events

The following Ansible events can be enabled in StackOne. Ansible sends an event only when the notifier is switched on for its group in the organization.

1

Job events

Events for job runs, workflow job runs, project updates and inventory updates.

  • Job Started (started) — Fired when a job leaves the queue and starts running
  • Job Succeeded (success) — Fired when a job finishes with the status successful
  • Job Failed (error) — Fired when a job ends with the status failed, error or canceled
2

Workflow approval events

Events for approval nodes in workflow job templates.

  • Workflow Approval Pending (workflow_approval.running) — Fired when a workflow reaches an approval node and waits for a decision
  • Workflow Approval Approved (workflow_approval.approved) — Fired when a user approves the approval node
  • Workflow Approval Denied (workflow_approval.denied) — Fired when a user denies the approval node
  • Workflow Approval Timed Out (workflow_approval.timed_out) — Fired when the approval node reaches its timeout without a decision

Delivery format

Details of how Ansible delivers events to StackOne.

1

One event per request

Each delivery is a single JSON object. Job events carry the job id, name, url, status, started and finished. The started event and the later succeeded or failed event of the same job share one job id.

2

No retries

Ansible sends each notification once and does not retry a failed delivery. Read the job from the API when an event may have been missed.

Verify

Your Connector should now be able to receive and process events. Try triggering an event and you should see an Event appear in the Connector logs.