STAGE 02 / BASE
Homelab P1–2
Runner P1
~68 credits
Foundations.
Infrastructure declared in code. Bare VMs become configured machines. The runner's spine — config, models, providers — compiles and starts cleanly under Docker Compose.
Goal
Reproducible substrate.
Two homelab VMs provisioned by Terraform. Ansible applies idempotently. Runner's docker compose up starts every service with no errors. Provider tests pass.
Exit criteria
- S3 fast + slow buckets exist via Terraform
- Prod-Services + Dev-Learning VMs reachable on Tailscale
- Ansible
site.ymlruns twice with no changes the second time - Pydantic Settings validates on app start
- All 4 providers (Ollama, Groq, Gemini, Anthropic) callable; tests green
- Davas health endpoint contract tested
Two tracks, one stage
Files & Kiro prompts
Homelab Phase 1 · Terraform
terraform/proxmox/main.tf— both VMsterraform/cloudflare/main.tfterraform/tailscale/main.tf+ ACLsterraform/aws/main.tf— buckets, IAM, lifecycle- S3 state backend (separate bucket)
docs/rebuild-from-zero.md
Homelab Phase 2 · Ansible Roles
roles/base— users, ssh, fail2banroles/docker— CE + compose pluginroles/tailscaleroles/nginxroles/restic— install only (cron in Stage 5)roles/k3s— disabled by defaultsite.yml+ inventory + group vars- Second run = zero changes
shared/
shared/config/settings.py— startup validation, vault path checkshared/models/job.pyshared/models/message.pyshared/models/provider.pyproviders/base.py— ABCproviders/ollama.py+ Davas healthproviders/groq.py· 429 loggingproviders/gemini.py·models/prefixproviders/anthropic.py·max_tokens=8192providers/router.py
infra + scaffolding
docker-compose.yml— 7 services declared.env.example— every var documentedrequirements.txtpinned via pip freezeinfra/terraform/main.tf— Contabo firewallinfra/terraform/dns.tfinfra/ansible/roles/docker/infra/ansible/roles/vault/— queue dirsinfra/ansible/roles/ollama/— model pullsinfra/ansible/roles/runner/— deploy composetests/test_providers/*— 4 files, mocked
# Paste into Kiro one phase at a time. Smaller context = fewer credits. # Always include the tech stack + non-negotiable rules at the top. ## Homelab — Phase 1 Build the Terraform layout described in homelab-iac-kiro-spec.md under "Phase 1 — Terraform". Targets: - terraform/proxmox/main.tf (Prod-Services + Dev-Learning) - terraform/cloudflare/main.tf - terraform/tailscale/main.tf - terraform/aws/main.tf (S3 fast/slow + IAM + lifecycle) - state backend in S3 (separate bucket) Output: working terraform plan with no manual edits. ## Homelab — Phase 2 Author the 6 Ansible roles listed in spec Phase 2. Idempotent. Vault-encrypt the tailscale auth key. Output: site.yml succeeds twice with zero changes second run. ## Runner — Phase 1 Build the Foundation files in llm-runner-kiro-spec.md Phase 1. Pydantic Settings v2 with startup validation. Every provider has a corresponding pytest file with mocked HTTP. Output: docker compose up starts every service; pytest green.
Where credits leak
+8 buffer
Proxmox provider
bpg/proxmox is fiddly; docs patchy. VM definitions may need a rework cycle.
QUIRK
Provider edges
Gemini needs models/ prefix · Anthropic requires max_tokens · Groq 429s.
CRITICAL
Davas health
Health-check davas-ollama.davidcockson.com/api/tags before routing. Never silently fall back.