Red Hat Event-Driven Ansible
Preview
When you integrate your Dynatrace environment with Red Hat Event-Driven Ansible controller using Red Hat Ansible for Workflows , you can automatically send events to the Event-Driven Ansible Controller by using the dt_webhook event source plugin.
Configure the integration
To use Red Hat Ansible workflow actions, you first need to install Red Hat Ansible for Workflows from Dynatrace Hub.
- In Dynatrace Hub , select Red Hat Ansible for Workflows.
- Select Install and then follow the process below to set up your Event-Driven Ansible environment, grant permissions, and configure the connection.
Set up Event-Driven Ansible controller for integration with Dynatrace
Grant permissions to Workflows
Configure Red Hat Event-Driven Ansible connection
Configuration of Event-Driven Ansible controller
Prerequisites
The collection dynatrace.event_driven_ansible that contains dt_webhook must be installed on the Event-Driven Ansible Controller.
For more information on the Event-Driven Ansible Controller , see Event-Driven Ansible controller user guide.
Project configuration
For more information on how to configure a project, see Event-Driven Ansible controller user guide.
Event source plugin and rulebook configuration
A rulebook activation is used to enable an event source. Hence, it is necessary to set up a rulebook.
The rulebook should be located in the configured project repository in the directory /rulebooks
. For more information, see Event-Driven Ansible rulebook example.
The first part of the rulebook is the configuration of the event source (source plugin). The second part of the rulebook configuration contains the actual rules. A rule includes conditions and actions.
Example rulebook for dt_webhook
To use the dt_webhook plugin, you need to configure it as a source in your rulebook. The following arguments must be set.
-
host
- This can be, for example, a localhost or 0.0.0.0.
-
port
- Configure the port which will be used from the source plugin to listen for events.
- Hints:
- The API URL in Red Hat Event-Driven Ansible Connection has the same
port
as defined here. - Prerequisite for the port configuration.
- The API URL in Red Hat Event-Driven Ansible Connection has the same
-
token
- Set the token variable configured in the rulebook activation on the Red Hat Event-Driven Ansible Controller.
---- name: Listen for events on dt_webhookhosts: allsources:- dynatrace.event_driven_ansible.dt_webhook:host: 0.0.0.0port: 5000token: '{{ <token_variable_name> }}'rules:- name: API Endpoint not availablecondition: event.payload.eventData["event.name"] is match ("Monitoring not available")action:run_job_template:name: "Trigger test playbook"organization: "Default"
When the rulebook configuration is done, ensure your project is synchronized to the Event-Driven Ansible Controller by clicking Sync project in the project list. The next step is then to configure the rulebook activation.
For more information on configuring a rulebook activation on the Event-Driven Ansible controller, see Setting up a rulebook activation.
When the rulebook activation is enabled, events can be sent from the workflow action to the Event-Driven Ansible Controller.
Grant permissions to Workflows
Some permissions are required by Workflows to run actions on your behalf.
To fine-tune permissions granted to Workflows
- Go to Workflows and select Settings > Authorization settings.
- Select the following permissions besides the general Workflows permission.
- Permissions needed for workflow actions:
app-settings:objects:read
state:app-states:read
state:app-states:write
state:app-states:delete
For more on general Workflows user permissions, see User permissions for workflows.
Configure Red Hat Ansible connection
You need a configured connection for your Red Hat Event-Driven Ansible environments.
To configure a connection for the Red Hat Event-Driven Ansible Controller
- Open the Settings app and go to Dynatrace Apps > Red Hat Event-Driven Ansible Connections.
- Select Add item.
- Provide a meaningful name for your connection.
- Provide your Red Hat Event-Driven-Ansible Controller URL, for example,
http://your-eda-controller.redhat.com:your-port
(must include theport
, which is configured in the Ansible Rulebook). - Provide your token of the Red Hat Event-Driven Ansible source plugin.
- Select Save changes.
Available action
The following workflow action is available for the Red Hat Event-Driven Ansible controller.
Send event to Event-Driven Ansible
Send an event to the Red Hat Event-Driven Ansible Controller via Event Source Plugin
POST /event
Send an event
Send event to Event-Driven Ansible
To send an event to Event-Driven Ansible in your workflow, you need to provide the information listed below.
To create a workflow that sends an event to Event-Driven Ansible
-
Go to Workflows and select to create a new workflow.
-
In the Choose trigger panel, select the trigger best suited to your needs.
-
On the trigger node, select to browse available actions.
-
On one of the information-extracting nodes, select , search for
Ansible
, and select Send event to Event-Driven Ansible. -
On each of the remaining information-extracting nodes, select and drag the line to the Send event to Event-Driven Ansible action.
-
In the Send event to Event-Driven Ansible action, select the connection to your Red Hat Event-Driven Ansible Controller.
-
Configure the event data field as needed. To learn how to use the output of information-extracting notes, see Expression reference.
The event data must be valid JSON.
-
To test your workflow, select Run.