Skip to main content

Ansible Automation

You can use this integration to:

  • Enable automation triggers for Ansible Tower from Moogsoft Enterprise.

  • Send alerts or Situations to Ansible with a payload for extra_vars and job template runtime variables.

Job Templates define the mapping rules which generate the request payload. You define these as name:rule pairs in the Workflow Job Template Mapping Rules section.

A Job Template provides default rules. You configure rules to meet the requirements for your Ansible request. Contact your Ansible Tower administrator for details.

The integration also adds four extra_vars to the request template:

  • aiops_event_id

  • aiops_type

  • aiops_integrationType

  • aiops_instance

Moogsoft Enterprise uses these to process a response to automation requests. Ansible ignores them when running a request, but they appear in the Ansible job report. These are in addition to the extra_vars already in the workflow job template configuration.

After you configure an automation integration, Moogsoft Enterprise automatically creates the 'Ansible Alert' and 'Ansible Situation' workflow engines. You can process alerts and Situations forwarded to these workflow engines with the following functions:

  • setAnsibleJob: Sets the Ansible Automation instance and job template rule set to use for an automation request.

  • sendToAnsible: Sends an automation request to Ansible.

See the Ansible documentation for details on Ansible components.

Before you begin

The Ansible integration has been validated with the Ansible Tower/AWX v2 API job-templates endpoint for Ansible Tower v3.6.3. Before you start to set up your integration, ensure you know the following values:

  • Credentials to run job templates in your Ansible instance.

  • Endpoint URL of your Ansible instance.

  • Proxy Settings: Configuration required to access Ansible.

From Tower v3.0 onwards, the Ansible Webhook Notification automatically sends the job status back to Moogsoft Enterprise. If you are using an earlier version of Ansible Tower, you must add a Moolet Informs module to each playbook you are requesting. For example:

- name: Restart service!
  hosts: all
	- name: Run command on target
	    shell: "{{ myCommand }}"
	    register: out

Configure the Ansible Automation integration

To configure the integration:

  1. Navigate to the Integrations tab.

  2. Click Ansible (Automation) in the Notification and Collaboration section.

  3. Provide a unique integration name. You can use the default name or customize the name according to your needs.

  4. Configure the Ansible automations for alerts or Situations to initiate and identify the payload you need.

  5. Define at least one instance. If you are running multiple instances of Ansible automation, identify any differences between them so you can configure these in the integration.

See the Ansible Automation Reference for a description of all properties.

See Configure Payload Mapping Rules and Macros Reference for more information on mapping rules and macros.

Configure Ansible

Log in to Ansible and add a Webhook Notification Template to each Ansible instance that you want to send results back to {product-name-placeholder}. For more help, see the Ansible documentation.

Ansible Field



Moogsoft Enterprise Integration


Send webhook event to Moogsoft Enterprise




Graze user configured in Moogsoft Enterprise

Basic Auth Password

Graze password configured in Moogsoft Enterprise

Target URL


HTTP Headers


HTTP Method


Add the Notification Template for SUCCESS and FAILURE states to each job template you want Moogsoft Enterprise to initiate. You can add these either in the Ansible UI, or using the Ansible job templates 'notification_templates_error' and 'notification_templates_success' REST API endpoints. See the Tower API Guide in the Ansible documentation for more information.

When posting to a Situation Room, Ansible truncates the output (stdout) of the Ansible job template to 4K bytes. The Situation Room provides a link to the full results in Ansible.

After you complete the configuration, you can make Ansible automation requests in your workflows. See setAnsibleJob for more information.

Note that the Ansible Alert workflow engine processes the output of 'Alert Workflows'. If you are using Cookbook or Tempus, you must configure these to process the output of Ansible Alert workflows.

For Cookbook, in Settings > Cookbook, set Process Output Of to Other Moolet(s) and enter "Ansible Alert Workflows", in addition to any other automation alert workflows you are using. See Configure a Cookbook for more information.Configure a Cookbook

For Tempus, use the Graze API to change the value. See addTempus and updateTempus for more information.