locomotive
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
locomotive
A self-hosted web app and MCP server for running the Ansible Playbooks in one Git repo: preview, launch, queue, schedule, and keep a history of every Run.
It replaces a general-purpose Ansible UI with something small and opinionated: one repo, one process, one SQLite database, and no login page (it sits behind a reverse proxy that supplies the user's identity).
Features
Launch form with live previews of the hosts and tasks a Run will touch, before it starts
Clean Runs of any remote branch, or Working Copy Runs in place, uncommitted changes and all
Per-host queue: two Runs never touch the same host at once
Run page with a task × host grid, recap, live log, Stop and Kill
Schedules (cron) with a Scheduler Ping to a healthchecks URL
ntfy notifications for failed, interrupted, missed and changed Runs
MCP server at
/mcp, so Claude Code and other agents can preview and start RunsLog retention: per-Run log cap, gzip, and daily pruning under a disk budget
Every Run's history row is kept forever. Not supported: multiple repos, users with different permissions, and logging in without a reverse proxy.
Related MCP server: ansible-mcp_python
What your Ansible repo needs
locomotive runs Playbooks from the repo at LOCOMOTIVE_REPO_URL. That repo needs:
playbooks/*.yml: each top-level file is a Playbook locomotive offers to run (hide some withLOCOMOTIVE_HIDDEN_PLAYBOOKS)Its inventory set by the repo's own Ansible config (locomotive passes no
-i)Optionally
collections/requirements.yml, installed into a cache per RunOptionally a
mise.tomlpinning the Ansible versions (see Where Ansible comes from)Optionally a Description for each Playbook and Tag, shown on the Launch screen:
a Playbook's is the block of
#comment lines at the top of the file (a leading---is fine). A bare#line starts a new paragraph. The first paragraph is the summary shown in the Playbook list.Tags get theirs from
locomotive.ymlat the repo root:tags: docker: Install and configure Docker hardening: SSH, firewall and sysctl lockdown
Where Ansible comes from
Each time a Run or preview prepares its runtime, locomotive checks the root of that checkout (the commit, or the Working Copy as it is on disk):
With a
mise.toml: locomotive runsmise install, then runs every Ansible tool throughmise exec. Themise.tomlmust pinansible-coreandansible-runner. Each commit or branch gets the versions it pins. Ifmiseisn't installed, the Run fails; locomotive does not fall back to PATH.Without a
mise.toml: locomotive uses theansible,ansible-runnerandansible-galaxyon its own PATH, with no install step. If any of them is missing, the Run fails and its reason names the missing executables. Every checkout uses the same versions.
The mise.toml is a mise config at the repo root that pins ansible-core, with
ansible-runner in the same install. Pinning makes a Run reproducible from its commit. A Working Copy whose
mise.toml or collections/requirements.yml changes while a Run is queued gets its Runtime prepared again
before the Run starts. This minimum file works:
[tools]
"pipx:ansible-core" = { version = "2.21.0", uvx_args = "--python 3.13 --with-executables-from ansible-runner" }pipx:ansible-coreinstalls ansible-core into an isolated install of its own (mise usesuvxfor this).--with-executables-from ansible-runnerputsansible-runnerin that same install. locomotive starts every Run throughansible-runner, so it must sit next to ansible-core.
Change version to pin a different ansible-core.
Collections from collections/requirements.yml are installed the same way on both paths. The Run log
says which path was taken. In a Working Copy, adding or removing mise.toml switches paths on the next
Run or preview.
Ansible runs inside locomotive's own process tree, so "PATH" means the container's PATH under Docker and
the machine's PATH on bare metal. The published image ships mise but no Ansible. To run a repo without a
mise.toml under Docker, extend the image:
FROM ghcr.io/tedkulp/locomotive:latest
USER root
RUN uv pip install --python /app/.venv/bin/python --no-cache ansible-core ansible-runner
USER 1000:1000On bare metal (python -m locomotive outside Docker), install ansible-core and ansible-runner any way
you like, as long as all three executables are on the PATH locomotive starts with.
Quick start (Docker)
Requires Docker with Compose.
cp .env.example .env # set LOCOMOTIVE_REPO_URL and the three access-guard values
docker compose pull
docker compose up -dThis runs the published image, ghcr.io/tedkulp/locomotive (linux/amd64 and linux/arm64).
LOCOMOTIVE_TAG picks the image tag:
| Image |
| The newest release |
| A release, or the newest patch of a minor version |
| The tip of |
To build from source instead, run docker compose up --build. The local build takes the same image name,
so run docker compose pull to go back to the published image.
The app listens on 127.0.0.1:8000 (change with LOCOMOTIVE_BIND / LOCOMOTIVE_HOST_PORT) and keeps
its data in ./data (LOCOMOTIVE_DATA_PATH). Put it behind a reverse proxy that sets the identity header.
Configuration
All settings are env vars prefixed LOCOMOTIVE_. .env.example lists them, and
src/locomotive/settings.py is the full source.
Variable | Purpose |
| The Ansible repo to run Playbooks from. Add |
| Database, mirror, Run dirs, logs and caches |
| Access guard: which peers may connect and which identities get in. Unset fails closed |
| Branch for clean Runs and Schedules (default |
| A clone to allow Working Copy Runs in |
| MCP clients' hashed bearer tokens, and the hostname they use |
| Notifications (off unless URL and topic are set) |
| Where the Scheduler Ping goes |
| IANA zone for cron and housekeeping (unset: |
| Per-Run log cap (200 MB) and budget for all logs (10 GB) |
Connecting an MCP client
Make a token:
TOKEN=$(openssl rand -hex 32)Hash it:
printf %s "$TOKEN" | sha256sumAdd
LOCOMOTIVE_MCP_TOKENS=<name>=<sha256>(comma-separate several) and restartRegister it:
claude mcp add --transport http locomotive https://<public hostname>/mcp --header "Authorization: Bearer $TOKEN"
start_run uses check mode unless called with confirm: true. See docs/behaviour.md
for the tool list.
Development
Requires mise (pins Python 3.13, uv, Node 22 and pnpm in mise.toml).
mise install
uv sync # backend deps
uv run pytest # backend tests
cd frontend && pnpm install
pnpm typecheck && pnpm build # frontend checks, built to frontend/distRun it locally. The access guard needs a trusted peer and an identity, so have your browser (e.g. a header
extension) send X-User: me:
LOCOMOTIVE_DATA_DIR=./data LOCOMOTIVE_REPO_URL=<repo url> LOCOMOTIVE_STATIC_DIR=frontend/dist \
LOCOMOTIVE_TRUSTED_PROXY_IPS=127.0.0.1 LOCOMOTIVE_IDENTITY_HEADER=X-User LOCOMOTIVE_ALLOWLIST=me \
uv run python -m locomotive # serves http://127.0.0.1:8000
cd frontend && pnpm dev # optional: Vite dev server proxying /api to :8000Layout
src/locomotive/: FastAPI app (one process: API, Run supervisor, scheduler), SQLite via SQLAlchemy + Alembicfrontend/: React + Vite + shadcn/ui, built to static files the backend servestests/: the seam 1 harness (app in-process over real HTTP, stub toolchain, local bare git remote, fake clock, fake HTTP server) and seam 2,tests/test_smoke_real_ansible.py: the real preview helper and one realansible-runnerRun againstlocalhost. Seam 2 needsmiseon PATH (skipped otherwise) and installs its Ansible runtime on first use.
More
docs/behaviour.md: the detailed rules for the queue, Working Copy, previews, Schedules, notifications, log retention and MCP
docs/describing-an-ansible-repo.md: instructions to hand an LLM (or follow yourself) to add Playbook and Tag Descriptions to your Ansible repo
GLOSSARY.md: what Run, Playbook, Working Copy, Schedule and Scheduler Ping mean here
Issues: GitHub Issues on this repo
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Git-native policy layer for AI agents: check_action verdicts against rules approved via PR.
App hosting your agent runs: git, deploys, staging/production, Postgres. Owner approves risky steps.
Run AI evaluations, record agent traces and gate releases on evidence, with scoped org access.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables comprehensive Ansible automation management through natural language, including playbook creation and execution, inventory management, role scaffolding, and project workflows. Supports both local inventories and full project lifecycle management with syntax validation and idempotency testing.30-
- FlicenseNot gradedqualityCmaintenanceMCP server for Ansible automation, enabling AI clients to list inventories, ping hosts, run ad-hoc commands, validate and execute playbooks, and manage playbook files via SSE.-
- FlicenseNot gradedqualityDmaintenanceMCP server that enables natural language interaction with an Ansible repository, providing tools for inventory inspection, syntax checking, and playbook execution with configurable safety controls.-
- AlicenseAqualityCmaintenanceEnables AI agents to safely inspect and execute version-controlled operational runbooks with policy checks, dry-run planning, and out-of-band approvals.3MIT