# sendToAnsible

A Workflow Engine function that sends an automation request to Ansible.

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

sendToAnsible requires a setAnsibleJob function that precedes it in your workflow.

This function is typically the last action in a workflow. After this action completes you can forward your alert or Situation data to another workflow for further processing. For example, if you want to send alert data to another automation tool.

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

## Arguments

Workflow Engine function sendToAnsible has no arguments.

## Example

The following example demonstrates typical use of Workflow Engine function sendToAnsible, in which you send Ansible a request to restart a service when Moogsoft Enterprise receives a new alert. It assumes you have set up and configured the following:

• An Ansible Automation integration with the name "Ansible1"

• A setAnsibleJob function where you have defined the automation solution, instance, and payload. You must configure these before you invoke the sendToAnsible function in your workflow.

• You have configured the setAnsibleJob arguments as follows:

• instance: Ansible1

• jobTemplateName: Restart-service

The Restart-service template you specify in the Ansible Automation integration defines mapping rules which build the request payload. In this scenario, one of the rules sets the extra_vars.serviceName field in the request to the alert's \$source_id, so the Ansible job tries to restart the service using this value.

### Note

You can use extra_var settings to pass additional information to Ansible job templates for the associated Ansible playbook to use.

Set the following:

• Forwarding Behavior: Always Forward.

If the request is successful, the function sets the alert or Situation's custom info status field to Pending. Otherwise, it sets to Failed. Automation results from the Ansible automation tool send back through a webhook that uses the Moogsoft Enterprise integration gateway generic endpoint. See Ansible Automation for more information.