Active
AI Generated
Service State Routing
Four fixes from one service check
Description
One host, one service (httpd). Run a check playbook that publishes service_state. Route remediation in a single switch — no nested Controller decision trees.
Why it matters
- service_state maps directly to the right fix — start, restart, or install — not generic success/failure guessing.
- One switch replaces nested Controller forks that obscure what failed and why.
- Demo-friendly with httpd — stop, fail, or remove the package and watch the workflow pick the correct path.
AO building blocks
Automation orchestrator step types this workflow uses on the canvas. See all building blocks
-
Triggers
Manual trigger
Starts a workflow when a user clicks Run in the UI or calls the workflow execution API — the simplest entry point for on-demand runs like demos, break-glass remediation, or operator-initiated changes. No extra configuration is required, and runs appear in history with the triggering user as the source.
-
Logic
Switch step
Evaluates conditions and routes execution to the first matching branch, supporting up to 100 ordered paths plus a fallback when nothing matches. Use it to branch on severity tiers, environment (dev/staging/prod), or AI agent output categories where a binary conditional isn't enough.
-
AAP execution
AAP job template
Launches a single Ansible Automation Platform job template from the workflow, polling until the job completes and exposing results to downstream steps. The standard bridge between automation orchestrator reasoning and AAP execution — one playbook with resolved inventory, credentials, limits, and extra vars.
Interactive Experience
Workflow
flowchart LR
A@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/manual-trigger.png", label: "Manual Trigger", pos: "b", h: 96, constraint: "on" } --> B@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/launch-aap-job-template.png", label: "Check Service", pos: "b", h: 96, constraint: "on" }
B --> C@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/switch-node.png", label: "service_state", pos: "b", h: 96, constraint: "on" }
C -->|active| D@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/launch-aap-job-template.png", label: "Log OK", pos: "b", h: 96, constraint: "on" }
C -->|inactive| E@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/launch-aap-job-template.png", label: "Start Service", pos: "b", h: 96, constraint: "on" }
C -->|failed| F@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/launch-aap-job-template.png", label: "Restart Service", pos: "b", h: 96, constraint: "on" }
C -->|not-found| G@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/launch-aap-job-template.png", label: "Install Service", pos: "b", h: 96, constraint: "on" }
D --> H@{ img: "https://ansible-tmm.github.io/aap-orchestrator-demos/assets/icons/launch-aap-job-template.png", label: "Notify Chatroom", pos: "b", h: 96, constraint: "on" }
E --> H
F --> H
G --> H
classDef noBorder fill:transparent,stroke:transparent
class A,B,C,D,E,F,G,H noBorder
Switch routing
| service_state | Path | Planned action |
|---|---|---|
active |
Green — done | Log OK, no changes |
inactive |
Yellow — start it | Start the service |
failed |
Orange — recover | Inspect logs and restart |
not-found |
Red — install | Install the package and enable the unit |
Playbooks
| Playbook | What it does | Runs on |
|---|---|---|
check_service.yml
|
Checks httpd service state via service_facts and publishes service_state artifact for the AO switch. | RHEL node |
remediate_log_ok.yml
|
Logs healthy service state with no changes to the host. | RHEL node |
remediate_start_service.yml
|
Starts an inactive service and verifies it is running. | RHEL node |
remediate_restart_service.yml
|
Captures journal errors, resets failed state, and restarts the service. | RHEL node |
remediate_install_service.yml
|
Installs the httpd package via dnf, enables and starts the service. | RHEL node |
notify_chatroom.yml
|
Posts service health status to Mattermost with color-coded severity. | localhost (Mattermost API) |
Demo ideas
- Stop httpd → workflow routes to inactive → start path
- dnf remove httpd → workflow routes to not-found → install path
AI Generated
This demo's playbooks and workflow were generated by AI to illustrate the pattern. They have not been fully tested in a live environment. Review and adapt before using in production.