Automate actions by routing external event streams: User scenarios
The following user scenario provides end-to-end instructions for integrating event streams with rulebook activations. You can automate responses to environmental events and streamline cross-platform workflows.
Modern IT environments generate a constant flow of operational data from diverse sources. Manually responding to these events creates bottlenecks and increases the risk of human error. Event-Driven Ansible addresses these challenges by creating a direct link between event-generating sources and automated remediation or orchestration tasks.
By implementing the scenarios in this chapter, you can move beyond simple point-to-point triggers to a more cohesive automation strategy. These workflows illustrate how the Red Hat Ansible Automation Platform controller acts as a central hub, receiving payloads from external platforms and transforming them into actionable, rule-based responses. This approach reduces time-to-resolution for common incidents and ensures that your infrastructure remains synchronized with your development and operational life cycles.
Route GitHub event streams to rulebook activations Copy linkLink copied!
Routing GitHub event streams allows Event-Driven Ansible controller to automatically ingest webhook payloads. This connects your repository events directly to rulebook activations, instantly triggering automated responses to code changes.
Event-driven automation relies on a consistent connection between an event source and the instructions that process those events. By using GitHub event streams, you create a secure, direct integration point for webhooks triggered by repository activities, such as pull requests, issues, or code pushes. This integration serves as the bridge between the external Git provider and the Ansible ecosystem.
Simplified event routing optimizes this connection by automatically directing incoming GitHub payloads to the appropriate rulebook activation. This architecture reduces the complexity of managing multiple webhook endpoints and ensures that the metadata from the GitHub event is accurately passed to your automation rules. This allows for near real-time responses to development workflows, such as automatically running a CI/CD playbook or updating a ticket when a branch is merged.
Prepare your GitHub repository and platform environment Copy linkLink copied!
Before configuring simplified event routing, you must prepare your Red Hat Ansible Automation Platform environment and GitHub repository. Ensuring that your decision environment, credentials, and rulebooks are properly aligned prevents errors during activation.
To successfully integrate GitHub event streams with rulebook activations, verify that the following components and configurations are in place:
- Decision environment
-
Use the image version that corresponds to your specific Ansible Automation Platform instance (for example,
de-minimal-rhel9). - Event stream credentials
- Configure credentials specifically for simplified event routing within the controller interface.
- Project synchronization
- Ensure your Ansible project is synced to the Git repository containing your rulebook YAML files.
- Plugin compatibility
-
Verify that your decision environment supports the required event source plugins (for example,
eda.builtin). - User Permissions
- Confirm you have sufficient permissions to create and manage rulebook activations in the controller.
- Active Event Source
- A functional webhook or message bus must be configured to send signals to the controller.
- Correct Namespacing
-
Ensure your rulebooks call current plugin namespaces (for example, using
amazon.awsrather than deprecatedansible.eda paths). - Rulebook Configuration
- Your rulebook must conform to the standard YAML format and specify the correct source and port (as in the following example).
YAML
---
- name: Listen for GitHub Events
hosts: all
sources:
- ansible.builtin.webhook:
port: 5000
rules:
- name: Respond to a Pull Request
condition: event.payload.action == "opened"
action:
debug:
msg: "A new pull request was opened!"
Create a GitHub event stream credential Copy linkLink copied!
Creating a GitHub event stream credential establishes the necessary authentication for the Red Hat Ansible Automation Platform controller to securely access your event source. This credential ensures that only authorized webhook payloads trigger your rulebook activations.
Procedure Copy linkLink copied!
Create a GitHub event stream Copy linkLink copied!
Creating an event stream and linking it to a pre-configured credential generates a unique URL for webhook configuration. This URL serves as the dedicated endpoint for the Red Hat Ansible Automation Platform controller to receive and process incoming GitHub event payloads.
Procedure Copy linkLink copied!
Configure your remote system to send events through GitHub webhooks Copy linkLink copied!
Configuring a GitHub webhook establishes the outbound connection from your repository to the Red Hat Ansible Automation Platform controller. This configuration enables your remote system to transmit event data directly to your designated event stream URL.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
Verify your GitHub event streams work Copy linkLink copied!
Verifying the event stream connection confirms that the Red Hat Ansible Automation Platform controller is successfully receiving data from the remote system. This validation ensures the integration is active and ready to trigger rulebook activations.
Procedure Copy linkLink copied!
- From the navigation panel in Ansible Automation Platform, select .
- Select the event stream you created (for example,
<_Your_Event_Stream_Name_>. - Toggle the Forward events to rulebook activation option in the top right to disable event forwarding. The Disable forwarding of events message is displayed.
- In the Disable forwarding of events message window, click the Yes, I confirm I want to disable the forwarding of events checkbox.
- Click Disable forwarding of events. A banner is displayed notifying you that events will not be forwarded to the rulebook activation where they are configured.
- Verify that you received the most recent event and its associated payload.
- In the Repo Event Stream that you just created, re-enable the event-forwarding capability by toggling the Forward events to rulebook activation option on.
Replace sources and attach GitHub event streams to activations Copy linkLink copied!
Attaching an event stream to a rulebook activation links your incoming GitHub data to specific automation rules. This process involves selecting a project and updating the event source to subscribe to the previously configured event stream.
Before you begin Copy linkLink copied!
Procedure Copy linkLink copied!
- From the Ansible Automation Platform navigation panel, select .
- Click Create rulebook activation to create a rulebook for events on an application repository for Linux servers.
- In the Name field, enter the name of your rulebook (for example,
<_Your_rulebook_activation_>). - For your Organization, select Default from the list.
- From the Project list, select the project with access to your rulebooks.
- In the Rulebook field, select the )rulebook associated with your project (for example,
<_Your-rulebook.yml_>). - In the Event streams field, click the gear icon to select which event stream the rulebook needs to subscribe to. The Event streams window is displayed.
- In the required Rulebook source field, replace an
ansible.builtin.webhookor compatible custom source with the desired event stream. This modifies the activation only, while leaving your filters intact. - Select <_Your_event_stream_> from the list of event streams that you created.
- Click Save to save your event stream.
- Next to the Credential field, click the Search icon to access automation controller and connect with job templates and workflows. The Select credential message is displayed.
- Select the Red Hat AAP credential and click Confirm.
- Select the appropriate Decision Environment from the list.
- Click Create rulebook activation. The activation status is displayed (if successful, the Running status displays).
- Repeat the following steps to create an additional rulebook activation using the same process as your first activation:
- In the Event streams field, click the gear icon to select which event stream the rulebook needs to subscribe to.
- Select the Repo Event Stream from the list of event streams that you created.
- Click Save to save your event stream.
- Click Create rulebook activation to save the configuration and start the rulebook.
Results Copy linkLink copied!
Resend webhook data from your event stream type Copy linkLink copied!
Resending webhook data allows for efficient testing of new event routing configurations. This process verifies that the event stream successfully triggers the rulebook activation using existing payloads, eliminating the need to manually recreate events.
Procedure Copy linkLink copied!
- Go back to the GitHub Webhook / Manage webhook page.
- Click the Recent Deliveries tab.
- Click the ellipsis.
- Click Redeliver. A Redeliver payload window is displayed with a delivery message.
- Click Yes, redeliver this payload.
- Return to the Ansible Automation Platform to check your rule audit.
Check the Rule Audit for events on your new event stream Copy linkLink copied!
Checking the Rule Audit provides a detailed record of events associated with a specific event stream. This administrative view allows for the verification of successful event processing and the inspection of actions triggered by incoming payloads.placeholder
Procedure Copy linkLink copied!
- From the Ansible Automation Platform navigation panel, select to see the event and actions.
- Select the name of the event in the list that is associated with the rulebook activation you created. The Details tab is displayed.
- Click the Events tab to view the event details.
- Click the Actions tab to see what action took place.
- If desired, click the Name of the action and view the Details tab to check the status.