Preview
When you integrate your Dynatrace environment with Red Hat Event-Driven Ansible controller using Red Hat Ansible Connector , you can automatically send events to the Event-Driven Ansible Controller by using the dt_webhook event source plugin.
To use Red Hat Ansible workflow actions, you first need to install Red Hat Ansible Connector from Dynatrace Hub.
Set up Event-Driven Ansible controller for integration with Dynatrace
Grant permissions to Workflows
Configure Red Hat Event-Driven Ansible connection
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.
For more information on how to configure a project, see Event-Driven Ansible controller user guide.
For more information on how to set up a new decision environment, see Event-Driven Ansible controller user guide.
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
port
port
as defined here.token
dt_webhook_token
.dt_webhook_token
is just an example name for the token variable. It could be also another name but the name must be the same in the rulebook activation and rulebook configuration.---- name: Listen for events on dt_webhookhosts: allsources:- dynatrace.event_driven_ansible.dt_webhook:host: 0.0.0.0port: 5000token: '{{ dt_webhook_token }}'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 repository is synchronized to the Event-Driven Ansible Controller by selecting Sync project in the project list.
The next step then is to configure the rulebook activation. Select Rulebook Activations from the navigation panel on your Event-Driven Ansible Controller. Select Create rulebook activation and fill in the required fields.
In the field Variables you define the token by setting your token variable from the Rulebook configuration. The rulebook variables are in a JSON/YAML format.
Ensure the variable name is identical in the rulebook activation and rulebook configuration.
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.
Some permissions are required by Workflows to run actions on your behalf.
To fine-tune permissions granted to Workflows
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.
You need a configured connection for your Red Hat Event-Driven Ansible environments.
This connection connects to the dt_webhook plugin within Red Hat Event-Driven Ansible. Open a specific port on your firewall to ensure the plugin is accessible for these connections. If this is impossible, you can use EdgeConnect to tunnel the traffic and make the environment accessible.
To configure a connection for the Red Hat Event-Driven Ansible Controller
http://your-eda-controller.redhat.com:your-port
(must include the port
, which is configured in the Ansible Rulebook).The following workflow action is available for the Red Hat Event-Driven Ansible controller.
Action
Description
Red Hat Ansible API endpoint
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
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.