Section 1 - Log Enrichment and Prompt Generation Workflow
Objective
In this section, we will build the first workflow called the AI Insights and Lightspeed prompt generation workflow. This workflow will be triggered by Event-Driven Ansible (EDA) whenever an issue is detected in the system. Specifically, this demo is set up to respond to an Apache (httpd) service failure.
This workflow will check the status of the Apache service, notify a Mattermost channel with details, ask Red Hat AI to analyze the incident, and finally create a new job template using the AI-generated prompt for Ansible Lightspeed.

By organizing these steps into a workflow, we simulate how multiple tools can collaborate to enrich a ticket or alert and prepare the remediation plan—all before a human even reviews the problem.
⚠️ This workflow will be automatically triggered by EDA once the ❌ Break Apache
job template is run. You must create this workflow before simulating the failure.
Introducing AI with Ansible
Red Hat AI is already deployed in this lab and powered by the Granite LLM model. You can interact with this AI using simple curl
commands or trigger it through Job Templates via Ansible Automation Platform.
Red Hat AI is deployed using two Ansible Content Collections:
-
redhat.ai
(Certified) -
infra.ai
(Validated)
These are available as part of your AAP subscription, giving your organization a quick and validated path to deploy generative AI models using automation.
Try It Yourself: Talk to the AI!
Before diving into the workflow, let’s see how easy it is to test this out yourself.
-
Open the Terminal in the lab.
-
Run the following
curl
command:
curl -X POST http://rhelai.example.com:8000/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {ssh_password}" \
-d '{
"model": "/root/.cache/instructlab/models/granite-8b-lab-v1",
"prompt": "What is the capital of USA?",
"max_tokens": 100,
"temperature": 0
}' | jq -r '.choices[0].text'
You can also try real-world prompts like:
curl -X POST http://rhelai.example.com:8000/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {ssh_password}" \
-d '{
"model": "/root/.cache/instructlab/models/granite-8b-lab-v1",
"prompt": "systemd[1]: httpd.service: Failed with result exit-code. Suggest a fix for Apache.",
"max_tokens": 150,
"temperature": 0.6
}' | jq -r .choices[0].text
This returns a JSON response with helpful AI suggestions. This is exactly what’s being automated in the next step via the 🤖 RHEL AI: Analyze Incident job template.
Exploring Mattermost Integration
In this lab environment, we’ve included Mattermost, a lightweight, open-source chat client that serves as a central place to view error logs and AI insights as part of your AIOps workflow.
Think of Mattermost as a stand-in for ServiceNow in this demonstration.
💡 In a real-world production environment, you can easily replace Mattermost with ServiceNow (or any other ITSM tool). This enables a more advanced automated workflow, where tickets are automatically created and enriched with logs and insights — all before a human even picks up the ticket!
Accessing Mattermost
Component | Value |
---|---|
Mattermost URL |
|
Username |
|
Password |
ansible123! |
-
Open mattermost using the above details
-
Click on “View in Browser” to open the console.
-
Login using the credentials provided.
-
Click on the team "Automators".
Once logged in, click on the Town Square channel from the left-hand navigation.
What You’ll See in Town Square
In the Town Square channel, you will eventually see:
-
🔍 Error logs from the Apache HTTPD service (collected by Filebeat and forwarded via Kafka)
-
🧠 AI Insights generated from the logs using RHEL AI
This real-time feed mimics how production environments might use automated ticket enrichment — by capturing logs and insights and sending them directly to a ticketing system like ServiceNow.
You won’t see any messages just yet — this step is simply to explain where Mattermost fits in and why this channel matters. Logs and insights will start appearing once the first workflow runs.
💡 With this integration, you are essentially watching AI and automation work together — detecting the issue, diagnosing it, and preparing remediation guidance before anyone intervenes.
Build the Workflow
System | URL | Credentials |
---|---|---|
Ansible Automation Platform |
AAP is preloaded in the lab interface. Click link if you want to open it in full tab: AAP Web UI |
Username: |
-
Login to Ansible Automation Platform.
-
Go to Automation Execution → Templates.

-
Click Create template → Create workflow job template.

-
Fill in the details:
Parameter | Value |
---|---|
Name |
AI Insights and Lightspeed prompt generation |
Organization |
Default |
-
Click Create workflow job template.

-
You’ll see the empty workflow visualizer.

-
Add the Apache Service Status Check node:
Parameter | Value |
---|---|
Node type |
Job Template |
Job Template |
⚙️ Apache Service Status Check |
Convergence |
Any |
Node alias |
(You can leave this blank) |

-
Click Next, then Finish.


-
Visual after first node:

-
Add RHEL AI: Analyze Incident step:
-
Click on the three dots (⋮ kebab menu) next to the ⚙️ Apache Service Status Check node.
-
Click on ⊕ Add step and link to insert the next node into the workflow.

Parameter | Value |
---|---|
Node type |
Job Template |
Job Template |
🤖 RHEL AI: Analyze Incident |
Status |
Run on success |
Convergence |
Any |
Node alias |
(You can leave this blank) |

-
Click Next, then Finish.


-
Workflow with two nodes:

-
Add Notify via Mattermost:
-
Click on the three dots (⋮ kebab menu) next to the 🤖 RHEL AI: Analyze Incident node.
-
Click on ⊕ Add step and link to insert the next node into the workflow.

Parameter | Value |
---|---|
Node type |
Job Template |
Job Template |
📣 Notify via Mattermost |
Status |
Run on success |
Convergence |
Any |
Node alias |
(You can leave this blank) |

-
Click Next, then Finish.

-
Add Build Ansible Lightspeed Job Template:
-
Click on the three dots (⋮ kebab menu) next to the 📣 Notify via Mattermost node.
-
Click on ⊕ Add step and link to insert the next node into the workflow.

Parameter | Value |
---|---|
Node type |
Job Template |
Job Template |
⚙️ Build Ansible Lightspeed Job Template |
Status |
Run on success |
Convergence |
Any |
Node alias |
(You can leave this blank) |

-
Click Next, then Finish.


-
Final workflow visual:

-
Click Save to finalize.

Trigger the Workflow
-
Run the
❌ Break Apache
job template. This inserts an invalid directive in Apache config and restarts the service.

-
Go to Automation Decisions(Event-Driven Ansible) → Rulebook Activations. Confirm EDA(Event-Driven Ansible) picked up the event.

-
Go to Automation Controller → Jobs. Confirm workflow execution. When the workflow completes you will see a green ✅ Success.

-
Go to Templates and you should be able to see a new job template called "🧠 Lightspeed Remediation Playbook Generator" generated. This step also creates a blank Workflow Job Template called "Remediation Workflow" that will be used in next challenge.
Final Checks & Observations
Before you move on to the remediation phase, take a moment to explore the Mattermost Town Square channel.
Here’s what to look for:
-
🛑 HTTPD Error Logs: These logs were automatically collected from the webserver.
-
🧠 AI Insights (RCA): Red Hat AI parsed the logs and generated a root cause analysis. These insights help you understand exactly why the failure occurred.
This is what real-world AIOps looks like! Imagine this in a production setting:
💡 A ticket appears in your ITSM tool with: - Attached logs - Root Cause Analysis (RCA) - A prompt ready for Lightspeed to generate the fix
And all of this before anyone has even opened the ticket.
We used Mattermost in this lab because it’s a lightweight, open-source chat platform that’s easy to run per student. But the same flow would work with ServiceNow, Jira, or any ITSM of your choice.
💡 Think of this as automated ticket enrichment. Logs and RCA can be pre-attached to incidents or alerts, helping teams respond faster and more effectively.
🎯 In short: You now have an intelligent incident response pipeline that goes from failure detection to context to fix suggestion — powered by Red Hat AI and Ansible Automation Platform.