Files
kevinveenbirkenbachandClaude Opus 5 351b64e2c5 refactor(deploy): resolve role groups at runtime instead of generating task files
`cli build include` generated one tasks/groups/<group>-roles.yml per invokable category during setup, and the stage plays included those files. They were written by the in-container UID, which is why a dedicated clean-container-owned helper had to delete them from inside the container.

The stage plays now loop over lookup('group_roles', <group>) and include tasks/utils/setup/{group,role}.yml directly. ordered_roles() in utils/roles/order.py holds the run_after topological sort the generator used to perform at build time.

utils/roles/stage.py:_group_names() no longer globs the generated files; it reads get_invokable_paths(), the same categories.yml source those files were derived from.

Measured: handlers still flush after every role (ansible-core 2.20.2, three loop items, three separate handler runs), and resolving all 18 groups costs 0.60s cold against 1.4s for the generator.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 23:21:34 +02:00

35 lines
769 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "🔧 Running project setup (no installation)"
: "${PYTHON:?PYTHON must be set by Makefile (venv python3)}"
echo "🐍 Using PYTHON=${PYTHON}"
if command -v "${PYTHON}" >/dev/null 2>&1; then
"${PYTHON}" -c 'import sys; print("sys.executable=", sys.executable)' || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error
fi
ROLES_DIR="./roles"
require_dir() {
local path="$1"
[[ -d "$path" ]] || {
echo "❌ Directory not found: $path" >&2
exit 1
}
}
require_cmd() {
command -v "$1" >/dev/null || {
echo "❌ Command not found: $1" >&2
exit 1
}
}
require_cmd "${PYTHON}"
require_dir "${ROLES_DIR}"
echo
echo "🎉 Project setup completed"