Configure an Event-Driven Ansible integration

You can use Event-Driven Ansible to take advantage of Hybrid Cloud Console capabilities such as Red Hat Lightspeed to continuously analyze your inventory for potential issues and recommendations. Event-Driven Ansible connects sources of events with corresponding actions through rules.

The integration with the Hybrid Cloud Console notifications service uses Event-Driven Ansible to trigger actions. Each account configures how and who can receive these events, with the ability to perform actions depending on the event type.

If you have any issues with the Hybrid Cloud Console integration with Event-Driven Ansible, contact Red Hat for support. To open a Red Hat support case directly from the Hybrid Cloud Console:

  1. Click Help (the ? icon) to open the help panel.
  2. Select the My support cases tab.
  3. Click Open a support case and add information about the issue.

Add the Event-Driven Ansible integration and verify the connection

You can configure event-driven Ansible integrations.

Before you begin

  • You are logged into the Red Hat Hybrid Cloud Console as an Organization Administrator or as a user with Notifications administrator permissions.
  • The redhat.insights_eda collection is installed and configured.
  • You have the webhook URL from Ansible.

Procedure

  1. In the Hybrid Cloud Console, navigate to Settings > Integrations.
  2. Select the Reporting & Automation tab.
  3. Click Add integration.
  4. Select Event-Driven Ansible as the integration type, and then click Next.
  5. In the Integration name field, enter a name for your integration (for example, ansible).
  6. Provide the URL that you configured in your Ansible rulebook into the Endpoint URL field. This is the endpoint URL that points to the controller running the Event-Driven Ansible receiver.
    Note

    The Endpoint URL must include http:// or https://, for example https://<eda_hostname>:5000/endpoint.

  7. Optional: Provide a Secret token if one is configured.
    Note

    A secret token is essential for protecting the data sent to the integration endpoint and should always be used when integrating the Hybrid Cloud Console with third-party applications.

  8. Click Next.
  9. Review the integration details, and then click Submit to enable the integration.

    Your Event-Driven Ansible integration is now listed on the Integrations > Reporting & Automation page. Under Last connection attempt, the status is Ready to show the connection can accept notifications from the console.

What to do next

Verify your integration:

Create a test notification to confirm you have successfully connected Event-Driven Ansible to the Hybrid Cloud Console:

  1. Next to your Event-Driven Ansible integration on the Integrations > Reporting & Automation page, click the options icon (⋮) and click Test.
  2. In the Integration Test screen, enter a message and click Send. If you leave the field empty, the Hybrid Cloud Console sends a default message.
  3. Open Event-Driven Ansible and check for the message sent from the Hybrid Cloud Console.
  4. In the Hybrid Cloud Console, go to Notifications > Event Log and check that the Integration: Event-Driven Ansible event is listed with a green label.

Configure Event-Driven Ansible 2.5 for integration

You can configure Event-Driven Ansible 2.5 to receive event notifications from the Red Hat Hybrid Cloud Console or a third-party application.

Before you begin

  • You have an environment with Ansible Automation Platform and Event-Driven Ansible 2.5 installed.
  • You have Organization Administrator or Notifications administrator permissions for the Hybrid Cloud Console.
  • You have a Github repository that contains at least one rulebook that uses the Red Hat Lightspeed EDA collection as a source. For examples, see Event-Driven Ansible for Red Hat Insights.

Procedure

  1. In your Ansible Automation Platform 2.5 environment, navigate to Automation Decisions > Infrastructure > Credentials.
  2. On the Credentials page, click Create credential.
  3. On the Create credential page, enter a name for the credential, for example Red Hat Lightspeed.
  4. Select the Organization type, and then select Token Event Stream under Credential type.
  5. Enter a token and copy it. The token value is used for token authentication between the Hybrid Cloud Console and your Ansible Automation Platform with Event-Driven Ansible.
    Note
    The token value can be any random string of characters, including uppercase or lowercase letters, numbers, and symbols. You can find token generators on the web.
  6. Enter X-Insight-Token under HTTP Header Key.
  7. Click Save credential.
  8. Navigate to Automation Decisions > Event Streams and click Create event stream.
  9. On the Create event stream page, enter a name for the event stream, for example Red Hat Lightspeed event stream.
  10. Select your organization under Organization.
  11. Select Token Event Stream under Event stream type.
  12. Select the credential that you created, for example Red Hat Lightspeed.
  13. Click Create event stream.
  14. On the Details tab of your event stream page, copy the event stream endpoint URL. This URL is used when setting up your Event-Driven Ansible integration in the Hybrid Cloud Console.
  15. Import an Ansible rulebook from your Github repository:
    1. To create an Ansible project, navigate to Red Hat Ansible Automation Platform > Automation Decisions > Projects.
    2. On the Create project page, enter a name for the project, for example Red Hat Lightspeed.
    3. Under Source control URL, paste the URL for the Github repository that contains your Red Hat Lightspeed rulebook and then click Create project.
    4. To activate your Red Hat Lightspeed rulebook, navigate to Red Hat Ansible Automation Platform > Automation Decisions > Rulebook Activations and click Create rulebook activation.
    5. Enter a name for your activation, for example Red Hat Lightspeed rulebook.
    6. Under Organization, select your organization.
    7. Under Project, select Red Hat Lightspeed.
    8. Under Rulebook, select a rulebook from the list.
    9. Select the gear icon next to Event streams and select the event stream that you created.
    10. Under Descision enviroment, select Default Decision Environment and then click Create rulebook activation. The rulebook page appears.
    11. Wait for the activation status to change to Running.
  16. In the Hybrid Cloud Console, navigate to Settings > Integrations.
  17. Select the Reporting & Automation tab.
  18. Click Add integration.
  19. Select Event-Driven Ansible as the integration type, and then click Next.
  20. In the Integration name field, enter a name for your integration (for example, My EDA Integration).
  21. Enter the event stream URL that you copied earlier into the Endpoint URL field. This is the endpoint that points to the Event-Driven Ansible listener. This endpoint URL must be accessible for the Hybrid Cloud Console to send HTTP POST events. You might need to configure your network access or firewall, or both, to accept HTTP POST events from the Hybrid Cloud Console.
  22. Enter the secret token that you created earlier.
    Note

    A secret token is essential for protecting the data sent to the integration endpoint and should always be used when integrating the Hybrid Cloud Console with third-party applications.

  23. Click Next.
  24. Review the integration details, and then click Submit to enable the integration.

    Your Event-Driven Ansible integration is now listed on the Integrations > Reporting & Automation page. Under Last connection attempt, the status is Ready to show the connection can accept notifications from the console.

What to do next

Verify your configuration:

Create a test notification to confirm you have correctly connected Event-Driven Ansible to the Hybrid Cloud Console:

  1. Next to your Event-Driven Ansible integration on the Integrations > Reporting & Automation page, click the options icon (⋮) and click Test.
  2. In the Integration Test screen, enter a message and click Send. If you leave the field empty, the Hybrid Cloud Console sends a default message.
  3. In Ansible Automation Platform with Event-Driven Ansible, navigate to Automation Decisions > Event Streams.
  4. On the Details tab of your event stream, confirm that the number under Events received has increased.
  5. In the Hybrid Cloud Console, go to Notifications > Event Log and check that the Integration: Event-Driven Ansible event is listed with a green label.
  • For more Event-Driven Ansible configuration information and examples of Red Hat Lightspeed rulebooks, see the Documentation tab in the insights_eda collection available from the Ansible Automation Hub Collections page.

Create the behavior group for the Event-Driven Ansible integration

A behavior group defines which notifications will be sent to external services such as Event-Driven Ansible when a specific event is received by the notifications service. You can link events from any Red Hat Hybrid Cloud Console service to your behavior group.

Before you begin

  • You are logged in to the Hybrid Cloud Console as an Organization Administrator or as a user with Notifications administrator permissions. Note
    You cannot log in to the Hybrid Cloud Console with your email address unless your email address is the same as your Red Hat login. For more information, see ../get-started/access-hcc.dita#finding-login.
  • The Event-Driven Ansible integration with the Hybrid Cloud Console is configured as described in Configure Event-Driven Ansible 2.5 for integration.

Procedure

  1. In the Hybrid Cloud Console, navigate to Settings > Notifications.
  2. Under Notifications, select Configure Events.
  3. Select the application bundle tab you want to configure event notification behavior for: Red Hat Enterprise Linux, Console, or OpenShift.
  4. Click the Behavior Groups tab.
  5. Click Create new group to open the Create behavior group wizard.
  6. Type a name for the behavior group and click Next.
  7. In the Actions and Recipients step, select Integration: Event-Driven Ansible from the Actions drop-down list.
  8. From the Recipient drop-down list, select the name of the integration you created (for example, My EDA Listener) and click Next.
  9. In the Associate event types step, select one or more events for which you want to send notifications (for example, Advisor: New recommendation) and click Next.
  10. Review your behavior group settings and click Finish. The new behavior group appears on the Notifications page.

What to do next

Verify your integration:

  1. Create an event that will trigger a Hybrid Cloud Console notification. For example, you can run the insights client command on a registered system to trigger a new recommendation event from Advisor.
  2. To validate that the Hybrid Cloud Console integration was successful, in the Hybrid Cloud Console, go to Settings > Notifications > Event Log and check that the last event that you triggered shows the label Integrations: Event-Driven Ansible.

    img integ eda.event

    • If the label is green, the notification succeeded.
    • If the label is red, verify that the stream has been properly created and exposed in Event-Driven Ansible, and that the correct stream URL is configured in the Hybrid Cloud Console integration configuration.
Note
See ../troubleshoot/troubleshoot-notif-failures.dita#proc-troubleshoot in the notifications documentation for more details.