feat!: remove the ai-stack role and ai_mainframes group #55

Merged
claudiomaradonna merged 3 commits from remove-ai-stack into main 2026-11-20 22:30:12 +01:00
Collaborator

Why

The ai-stack role ran LocalAI, LocalAGI and LocalRecall as a standalone
compose project on hosts in ai_mainframes; one host in one tenant used
it. The stack is moving to the separate Ansible that manages the Docker
Swarm, so castrum no longer needs the role, its group, its molecule
scenario, the community.docker collection only it used, or the
migration guide that handed a hand-run stack to it. Keeping a deprecated
role or adding a one-off uninstall mode were considered and set aside.

What changed

roles/ai-stack/, group_vars/ai_mainframes.yml, its .gitignore
exception, its MOLECULE_ROLES and service_roles entries,
community.docker and docs/MIGRATION-AI-STACK.md are removed. Before,
a host in ai_mainframes got the stack, the ai-stack nftables chain
(3000/8080) and docker-engine through the role's meta dependency;
after, ai_stack_enabled and the group do nothing.

docker-engine now stands alone: docker_engine_gpu_required defaults
to false instead of following ai_stack_gpu_enabled, its tasks lose
the ai-stack tag, and install mode no longer installs
python3-requests, which only the stack's health wait needed.

The firewall-apply scenarios and the peer_derivation and
firewall_render gates used ai-stack's port file as an example; they
now cover the same rules through webserver (open rule, including that
it names no source), swarm (sources-only rule) and gluster. The
documentation's --tags ai-stack examples use swarm.

Breaking, with action required before the next fortify.yml run on
a host that joined ai_mainframes: back up
/opt/ai-stack/data/localrecall, stop the stack with
docker compose -f /opt/ai-stack/compose.yml down, remove the host from
ai_mainframes and its ai_stack_* host variables, and, where the host
keeps Docker and wants its engine asserted, set docker_engine_enabled
(and docker_engine_gpu_required for a GPU) in its host_vars. That run
removes the ai-stack chain; running containers are left as they were.
/opt/ai-stack/.env and the vaulted secrets stay until removed by hand.

How to verify

Setup as in CONTRIBUTING; base 13cfd32
(main), branch remove-ai-stack at 607ddc0.

  1. Nothing names the removed parts. On the branch,
    git grep -n -i -E 'ai[-_]stack|ai_mainframes|MIGRATION-AI-STACK|localagi|localrecall|community\.docker'
    prints nothing (on the base, git grep -l with it lists 33 files); git grep -il localai
    lists only roles/traefik-routes/, whose example route keeps that
    fictional name. Run: as expected.
  2. Peer derivation still holds over the remaining port files. The
    branch's tests/fixtures/peer_derivation/ and
    tests/gates/check_peer_derivation.sh, copied onto the base, pass
    there, and pass on the branch: ./tests/gates/check_peer_derivation.sh
    prints "peer derivation: swarm and gluster admit exactly the
    reachable peer…". Run: passed on both.
  3. make check passes on the branch and on each of its three commits.
    Run: passed.
  4. Not run: make test, that is the firewall-apply molecule
    scenarios default and peered, the remaining roles' scenarios and
    the tag_propagation gate, because podman was absent where this was
    built. Expected: every scenario passes and grep '^ERROR' finds
    nothing.

Considerations

  • ai-stack's port file was the only one with a templated open:
    value, so no test renders one now. No remaining port file uses one,
    and firewall-apply casts open with | bool.
  • Hosts that already carry python3-requests keep it; only new
    install runs stop installing it.
## Why The `ai-stack` role ran LocalAI, LocalAGI and LocalRecall as a standalone compose project on hosts in `ai_mainframes`; one host in one tenant used it. The stack is moving to the separate Ansible that manages the Docker Swarm, so castrum no longer needs the role, its group, its molecule scenario, the `community.docker` collection only it used, or the migration guide that handed a hand-run stack to it. Keeping a deprecated role or adding a one-off uninstall mode were considered and set aside. ## What changed `roles/ai-stack/`, `group_vars/ai_mainframes.yml`, its `.gitignore` exception, its `MOLECULE_ROLES` and `service_roles` entries, `community.docker` and `docs/MIGRATION-AI-STACK.md` are removed. Before, a host in `ai_mainframes` got the stack, the `ai-stack` nftables chain (3000/8080) and `docker-engine` through the role's meta dependency; after, `ai_stack_enabled` and the group do nothing. `docker-engine` now stands alone: `docker_engine_gpu_required` defaults to `false` instead of following `ai_stack_gpu_enabled`, its tasks lose the `ai-stack` tag, and `install` mode no longer installs `python3-requests`, which only the stack's health wait needed. The `firewall-apply` scenarios and the `peer_derivation` and `firewall_render` gates used `ai-stack`'s port file as an example; they now cover the same rules through `webserver` (open rule, including that it names no source), `swarm` (sources-only rule) and `gluster`. The documentation's `--tags ai-stack` examples use `swarm`. **Breaking, with action required** before the next `fortify.yml` run on a host that joined `ai_mainframes`: back up `/opt/ai-stack/data/localrecall`, stop the stack with `docker compose -f /opt/ai-stack/compose.yml down`, remove the host from `ai_mainframes` and its `ai_stack_*` host variables, and, where the host keeps Docker and wants its engine asserted, set `docker_engine_enabled` (and `docker_engine_gpu_required` for a GPU) in its `host_vars`. That run removes the `ai-stack` chain; running containers are left as they were. `/opt/ai-stack/.env` and the vaulted secrets stay until removed by hand. ## How to verify Setup as in [CONTRIBUTING](CONTRIBUTING.md#setup); base `13cfd32` (main), branch `remove-ai-stack` at `607ddc0`. 1. Nothing names the removed parts. On the branch, `git grep -n -i -E 'ai[-_]stack|ai_mainframes|MIGRATION-AI-STACK|localagi|localrecall|community\.docker'` prints nothing (on the base, `git grep -l` with it lists 33 files); `git grep -il localai` lists only `roles/traefik-routes/`, whose example route keeps that fictional name. Run: as expected. 2. Peer derivation still holds over the remaining port files. The branch's `tests/fixtures/peer_derivation/` and `tests/gates/check_peer_derivation.sh`, copied onto the base, pass there, and pass on the branch: `./tests/gates/check_peer_derivation.sh` prints "peer derivation: swarm and gluster admit exactly the reachable peer…". Run: passed on both. 3. `make check` passes on the branch and on each of its three commits. Run: passed. 4. **Not run:** `make test`, that is the `firewall-apply` molecule scenarios `default` and `peered`, the remaining roles' scenarios and the `tag_propagation` gate, because podman was absent where this was built. Expected: every scenario passes and `grep '^ERROR'` finds nothing. ## Considerations - `ai-stack`'s port file was the only one with a templated `open:` value, so no test renders one now. No remaining port file uses one, and `firewall-apply` casts `open` with `| bool`. - Hosts that already carry `python3-requests` keep it; only new `install` runs stop installing it.
The AI stack leaves this repository, so its port file can no longer
serve as the example in the firewall-apply scenarios and the
peer_derivation gate. webserver now carries the open-rule assertions,
including that an open rule names no source; swarm alone carries the
restricted-rule ones; peer derivation runs over swarm and gluster.
docker-engine was mostly reached as ai-stack's meta dependency and took
its GPU requirement, its ai-stack tag and python3-requests, which only
ai-stack's community.docker health wait used, from there. With the AI
stack leaving the repository, the GPU assert stays as docker-engine's
own per-host switch, defaulting to off.

BREAKING CHANGE: docker_engine_gpu_required no longer follows
ai_stack_gpu_enabled; a host that needs the GPU assert sets it itself.
install mode no longer installs python3-requests; hosts that have it
keep it.
feat!: remove the ai-stack role and ai_mainframes group
All checks were successful
check / check (pull_request) Successful in 19m29s
check / check (push) Successful in 19m16s
607ddc0936
The LocalAI, LocalAGI and LocalRecall stack moves to the Ansible that
manages the Docker Swarm, so castrum stops carrying it: the role, its
group, its molecule scenario, the community.docker collection only it
used, and the migration guide go. The documentation's examples that
used ai-stack now use swarm.

BREAKING CHANGE: ai_stack_enabled and ai_mainframes no longer do
anything. Before the next fortify.yml run on a host that joined
ai_mainframes, stop the stack by hand (docker compose -f
/opt/ai-stack/compose.yml down, after backing up
/opt/ai-stack/data/localrecall), drop the host from ai_mainframes and
its ai_stack_* host_vars. That run removes the ai-stack firewall chain
and no longer loads docker-engine, which came in as ai-stack's
dependency; running containers are left as they were. A host that keeps
Docker and wants its engine asserted sets docker_engine_enabled, and
docker_engine_gpu_required for a GPU, in its host_vars.
claudiomaradonna deleted branch remove-ai-stack 2026-11-20 22:30:19 +01:00
Sign in to join this conversation.
No description provided.