setAnsibleJob

A Workflow Engine function that sets the instance and job template rule set to use for Ansible automation requests. Checks the template name against yourAnsible Automation integration for a matching job template name. If found, uses the rule set to generate the request payload. Otherwise, uses the default job template rules.

This function relates directly to configurations from your Ansible Automation integration.

setAnsibleJob typically precedes a sendToAnsible action in your workflow, which uses the payload this function generates.

This function is available as a feature of the Add-ons v1.3 download and later.

This function is only available for automation alert and automation Situation workflows.

Back to Workflow Engine Functions Reference.Workflow Engine Functions Reference

Arguments

Workflow Engine function setAnsibleJob takes the following arguments:

Name

Required

Type

Description

instance

Yes

String

Name of your Ansible Automation integration instance.

jobTemplateName

Yes

String

Name of the template. Must match the Workflow Job Template Name in your Ansible Automation integration.

Example

The following example demonstrates typical use of Workflow Engine function setAnsibleJob. It assumes you have set up the following:

  • An Ansible Automation integration with the name "Ansible1".

  • Within your Ansible Automation integration, a Workflow Job Template Name instance called "Restart-service".

Set the following:

  • instance: Ansible1

  • jobTemplateName: Restart-service

  • Forwarding Behavior: Stop this workflow. This prevents further processing if the function fails to locate your configuration and returns false.

The UI translates your settings to the following JSON:

{"instance":"Ansible1","jobTemplateName":"Restart-service"}