Ansible audit — AZ One Health Sentinel (EpiHack AZ 2026)

Date: 2026-05-23 · Branch: feat/profile-dashboards · Live demo: http://epihack-test.cis240692.projects.jetstream-cloud.org/ Generated by: background subagent during Phase 0 of plan/10-archival-and-docs.md.

This audit is the source-of-truth for Phase 7 (Ansible refresh) of the archival plan. Each numbered item below is a deliverable: when we implement it, link the PR back here.

Top-level summary

# Role Status
1 common GREEN
2 node YELLOW
3 python GREEN
4 postgres GREEN
5 repo GREEN
6 claude_code GREEN
7 mcp_servers YELLOW
8 ducklake GREEN
9 mongodb GREEN
10 fastapi YELLOW
11 app RED
12 nginx YELLOW
_ playbook.yml GREEN
_ requirements.yml YELLOW
_ group_vars/all.yml YELLOW

Totals: 12 roles audited (the directory holds 12, not 14 as initial recon suggested). GREEN = 6, YELLOW = 5, RED = 1.

Top 3 must-fix before archive

  1. app_client_channel missing end-to-end. The 2026-05-20 datastore split routes mobile writes to MongoDB and web writes to DuckLake via the X-Client-Channel header, set from NEXT_PUBLIC_CLIENT_CHANNEL. The Ansible app role never sets it; the build silently falls back to "web". Correct for the VM today, but any Capacitor mobile build off the same playbook would silently mis-route — defeating the architecture decision. Fix: add app_client_channel: "web" to group_vars/all.yml and plumb it through roles/app/tasks/main.yml and roles/app/templates/app.env.local.j2.

  2. Claude.ai custom-connector path is half-wired. roles/nginx proxies /mcp/<name> per mcp_http_servers, but no role creates the systemd units that listen on those ports. Only vectorsurv-mcp honors FASTMCP_HOST/PORT/STREAMABLE_HTTP_PATH. And the live demo is HTTP-only, but Claude.ai requires HTTPS. Fix: add a roles/mcp_servers/tasks/http_units.yml that renders one systemd unit per entry in mcp_http_servers; port the FASTMCP shim from vectorsurv-mcp/__main__.py to the other 10 MCP servers (a repo change, not Ansible); flip tls_enabled: true with a real vault_tls_email for the Jetstream2 host.

  3. Synthetic dataset operationally invisible. The 4,395-observation demo load under /srv/onehealth/ came from /tmp/gen_synth.py — not tracked in the repo. scripts/export_signals.py is tracked but is never run by Ansible. Nginx doesn’t serve dashboard/signals/. Fix: promote the generator into scripts/load_synthetic_observations.py, add an opt-in ducklake_load_synthetic_demo toggle to roles/ducklake, and add a /dashboard/ nginx alias gated by a new serve_dashboard toggle.

Per-role findings

Role 1 — common — GREEN

apt base packages, UTC timezone, deploy user + group, /srv/onehealth/, 2 GB conditional swap, UFW deny-incoming + allow SSH/80/443, fail2ban. Note: mongosh arrives via mongodb-org in roles/mongodb, an implicit cross-role coupling that works fine.

Role 2 — node — YELLOW

Pins node_major_version: "20" but next@16 requires Node 20.18.1+. NodeSource currently ships 20.19+, so a fresh provision works today, but the pin is implicit. Add: a node --version assertion task that exits non-zero below 20.18.1.

Role 3 — python — GREEN

Python 3.12 (requires-python = ">=3.11" across all consumers — match), uv to /usr/local/bin. Soft pin uv_version: "latest" is fine for a demo.

Role 4 — postgres — GREEN

Postgres 16 as the DuckLake catalog only. No app schema lives directly in Postgres. Verified that kg_writer.py + audit.py connect via ducklake:postgres: URIs, not raw postgresql:.

Role 5 — repo — GREEN

Two modes: local-path rsync (excluding build artifacts) or git clone with force: true. Both notify Restart fastapi. Writes DEPLOYED_SHA marker. Clean.

Role 6 — claude_code — GREEN

npm i -g @anthropic-ai/claude-code (state: latest), writes ~/.claude/settings.json and .bashrc ANTHROPIC_API_KEY=… with no_log: true. MCPs are wired in the separate ~/.claude.json by design.

Role 7 — mcp_servers — YELLOW

uv sync each of the 11 servers, render ~/.claude.json, claude mcp list smoke. Drift:

Fix:

# group_vars/all.yml — new vars:
sms_mode:        "mock"
nws_user_agent:  "az-onehealth-sentinel/0.1 (+https://github.com/tyson-swetnam/epihack-2026)"

Plus a new roles/mcp_servers/tasks/http_units.yml that loops over mcp_http_servers and renders one systemd unit per entry from an mcp-http.service.j2 template.

Role 8 — ducklake — GREEN

DuckDB CLI 1.5.3 → /usr/local/bin, Parquet dir at /srv/onehealth/ducklake-data, idempotent seed via the kg-mcp venv. Schema order enforced via discover_schema_files (CLAUDE.md’s standards.sql then pathogens.sql rule).

Operational gap: the synthetic demo dataset (4,395 obs) on the running VM came from a one-off /tmp/gen_synth.py that isn’t tracked. Rebuild loses it. See Top-3 fix #3.

Role 9 — mongodb — GREEN

MongoDB 8.0, bindIp: 127.0.0.1, authorization: enabled, app user created on admin DB via localhost exception, marker file at /srv/onehealth/.mongo-user-created ensures one-time creation. Cross- references cleanly with agents/src/onehealth_agents/mongo_writer.py:50.

Role 10 — fastapi — YELLOW

uv sync, pre-install ducklake+postgres DuckDB extensions, env file at /etc/onehealth-api.env, systemd unit with ProtectHome=true, wait for /v1/healthz 200, install the Mongo→DuckLake sync timer (OnUnitActiveSec=5min). Drift:

Fix: add mongo_sync_enabled: true to group_vars/all.yml and gate the timer’s install + start.

Role 11 — app — RED

NEXT_PUBLIC_CLIENT_CHANNEL is missing from both the build env and app.env.local.j2. This var is the core of the 2026-05-20 datastore split:

Fix:

# group_vars/all.yml — REQUIRED:
app_client_channel: "web"

# roles/app/tasks/main.yml — extend the build env:
environment:
  ...
  NEXT_PUBLIC_CLIENT_CHANNEL: ""

# roles/app/templates/app.env.local.j2 — append:
NEXT_PUBLIC_CLIENT_CHANNEL=

Role 12 — nginx — YELLOW

/api/ → 127.0.0.1:8000, /_next/static/ immutable cache, /query/ + /schema/ for DuckDB-WASM, /mcp/<name> per mcp_http_servers, / → app/out static. Security headers good. Drift:

Fix: add a location /dashboard/ block to the nginx template, gated on a new serve_dashboard toggle (defaults true), aliasing to /dashboard/ with try_files $uri $uri/ =404;. See the actual diff in roles/nginx/templates/onehealth.conf.j2 on commit 4be8546. Also: tls_enabled: true with a real vault_tls_email for the Jetstream2 host.

Cross-cutting

playbook.yml — GREEN

Role order matches README.md. vars_files correctly limited to all.vault.yml per the prior CHANGELOG fix. Ubuntu/Debian assertion in pre_tasks. Good.

requirements.yml — YELLOW

community.general, community.postgresql, ansible.posix. community.mongodb would enable idempotent user creation (currently done via mongosh + shell:).

group_vars/all.yml — YELLOW

Consolidated additions:

app_client_channel:            "web"
sms_mode:                      "mock"
mongo_sync_enabled:            true
ducklake_load_synthetic_demo:  false
serve_dashboard:               true
nws_user_agent: "az-onehealth-sentinel/0.1 (+https://github.com/tyson-swetnam/epihack-2026)"

inventory.yml is committed with localhost-specific overrides

inventory.yml:22 sets onehealth_repo_url: /home/exouser/epihack-2026 — exouser-specific. A new collaborator running the playbook from a different machine will rsync the wrong tree. Fix: git rm --cached ansible/inventory.yml and keep only inventory.example.yml.

all.vault.yml plaintext — acceptable

vault_postgres_password: "onehealth_local_dev_change_me" etc. — all marked as demo placeholders. Real secret slots are empty strings. Fine for a public archive.

Draft ansible/CHANGELOG.md entry

## post-EpiHack archive refresh — 2026-05-23

Tightening pass after the 2026-05-20 datastore split (Mongo for mobile,
DuckLake for web/analytics), the profile-enrichment + personal-dashboard
landing (commit 9039423), and the vectorsurv-mcp Claude.ai connector
deploy (commit 199bcfc). Audit notes in plan/ANSIBLE-AUDIT-2026-05-23.md.

### Changes

- roles/app — added NEXT_PUBLIC_CLIENT_CHANNEL to both the build env
  and app.env.local.j2 so the X-Client-Channel header routing
  (mobile -> Mongo, web -> DuckLake) is honored by every build.
  Driven by a new app_client_channel group var (defaults to "web").
- roles/nginx — added /dashboard/ static-alias block (gated on a new
  serve_dashboard toggle) so the signal-monitor at dashboard/signals/
  resolves on the live VM, not just on GitHub Pages.
- roles/mcp_servers — moved SMS_MODE out of the template into a new
  sms_mode group var; added NWS_USER_AGENT to the nws-heatrisk-mcp env
  block. Added a sibling http_units.yml task file that renders one
  systemd unit per entry in mcp_http_servers, paving the documented
  Claude.ai custom-connector path.
- roles/fastapi — removed unused DATABASE_URL env line from the unit
  env file. Added a mongo_sync_enabled gate around the
  Mongo->DuckLake timer.
- roles/ducklake — added opt-in ducklake_load_synthetic_demo toggle
  that runs scripts/load_synthetic_observations.py (newly tracked,
  promoted from the one-off /tmp/gen_synth.py).
- roles/node — added a node --version >= 20.18.1 assertion.
- group_vars/all.yml — new vars: app_client_channel, sms_mode,
  mongo_sync_enabled, ducklake_load_synthetic_demo, serve_dashboard,
  nws_user_agent.

### Known gaps (not blocking, tracked)

- Only vectorsurv-mcp/src/.../__main__.py honors FASTMCP_HOST/_PORT/
  _STREAMABLE_HTTP_PATH. The other 10 MCP servers need the same shim
  before they can be exposed as Claude.ai remote connectors.
- The live demo (http://epihack-test.cis240692.projects.jetstream-cloud.org)
  still terminates plain HTTP. Claude.ai custom connectors require
  HTTPS — needs tls_enabled: true + a real vault_tls_email.
- mcp/wearable-mcp/ is the only server without a .env.example.