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

Interactive Experience

Coming soon

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.