Repository navigation
Description
Update 2026-11-26 (infra move): tools.lock is gone and the environment move is done.
ansible-runner and ansible-core come from the devtools image, not from tools.lock (#6555). Argo CD reads the environment from dan-petty/homelab since 2026-11-23. Step 17, which deletes the devops-cli copy, is #7290. The listed items are closed, except #5134 (its step 17 is #7290). Before you close this tracker, check the scope comments (an apply result line, more status columns) and the last criterion.
Problem or Motivation
The owner, 2026-11-12:
- "I also want to have native devops cli functionality to manage an infrastructure environment stored in a git repo, mine being https://github.com/dan-petty/homelab"
- "Agents apply all" (agents may apply any play after a plan, including drain, k3s restart and reboot of one node at a time; only secrets and hardware stay with the owner)
- "agent use approval of the infra repos should be configurable, and I want homelab specifically to be full access to agents because it is dedicated to developing, troubleshooting, and validating project features and capabilities"
- "you should also use the homelab repo to validate the devops cli infra repo onboarding functionality"
- "once infra environment repo management is supported, we can move homelab configuration artifacts to that repo and update argocd config"
- "build the functionality into the devops cli infra management feature and let me know when that is ready"
Today a person runs make targets of dan-petty/homelab, and AGENTS.md says that only a person changes hosts. Live example: a GPU node (<gpu-node>) hung on 2026-11-10 and came back with 16 GiB. dan-petty/homelab#19 (kubelet memory reservation) and dan-petty/homelab#20 (crash capture) are merged and not applied; the Claude Code auto-mode classifier refused make k3s ANSIBLE_ARGS="--limit <gpu-node>" from an agent.
Proposed Solution & Architectural Design
A new command group devops infra for infra repos: git repositories with an Ansible inventory, playbooks and roles. dan-petty/homelab is the first and the validation repo.
Engine: the ansible-runner CLI (Apache-2.0, 2.4.3), run through run_subprocess, from the devtools image (ansible-core + ansible-runner). It gives the AWX job events, a run folder for each run, timeouts, and a remote mode for later. Not its Python API: that starts ansible-playbook inside the devops process and copies os.environ past the subprocess guards. ansible-core is GPL-3.0-or-later and stays in its own process.
Contract: settings infra.repos[] (repo, path, kube_context, ssh_key_prefix, agent_access). The repo gives the rest with standard Ansible: ansible.cfg, the inventory, the offline group, collections/requirements.yml, serial, and inventory variables devops_infra_node_service, devops_infra_nondisruptive_units, devops_infra_node_name (read with the debug action plugin, no SSH). No new manifest file. The repo gives its Kubernetes environment tree as the profile fact kubernetes.dir in .devops/project.toml. infra.repos[] has no k8s_dir key, because InfraRepoConfig forbids extra keys.
Agent access level of each repo (infra.repos[].agent_access): none (default; an agent reaches no host), plan (status --ping, plan, drift), safe (also apply a plan with no disruptive task and no unchecked task; uncordon), full (also any plan and the node commands, one node at a time). Only a person sets it. dan-petty/homelab is full.
| Command | Does |
|---|---|
devops infra onboard <repo> |
Detects and checks the repo; --confirm records it (level none unless a person gives another) |
devops infra status <repo> |
Inventory hosts joined with node state from the Kubernetes API; --ping adds SSH and pending reboot |
devops infra plan <repo> <playbook> |
Check mode with diff on an exported commit; per host: changed, unchecked, diff hidden, disruptive (reboot, service-restart:<unit>, drain); a saved plan with a hash |
devops infra apply <repo> --plan <id> |
Applies a saved plan with the guards below |
devops infra drift <repo> |
Plan of the default branch on every in-service host; gauge; one issue in the infra repo |
devops infra node drain|uncordon|restart|reboot <repo> <host>... |
The node life cycle with health gates; replaces the per-host Makefile targets |
Guards at every level, for every caller: a plan of the same commit, playbook, limit and tags, not older than infra.plan_max_age_hours; the commit is on origin; host key checks on for an agent; health before; one disruptive node at a time (drain, fresh check equal to the plan, run, Ready, GPU count, uncordon only if it was schedulable, health); an unplanned change stops the run; the first failure stops and leaves the node cordoned; an audit record (record_audit_event: caller, level, repo, commit, plan hash, hosts, result); metrics devops_cli_infra_runs_total, devops_cli_infra_drift_hosts; --dry-run makes zero requests. Secrets and hardware stay with the owner: only the devops ssh key goes to Ansible.
Claude Code permission rule (owner step): the project .claude/settings.json allows Bash(uv run devops *), and a matching allow rule resolves before the auto-mode classifier, so uv run devops infra ... as one plain command needs no other rule. Keep that rule. A compound shell line (an assignment, ;, &&, |) falls to the classifier. If auto mode drops the rule (the docs say that it drops package-manager run-command rules, and do not name uv run), the fallback is an autoMode.allow entry in ~/.claude/settings.json. The access level in the CLI stays the real control.
Policy text that the apply item writes (as merged). AGENTS.md, today: "Only a person merges pull requests (release-merge.yml merges the release pull request), records verdicts, plans milestones and changes secrets, repository settings and hosts." After: "Only a person merges pull requests (release-merge.yml merges the release pull request), records verdicts, plans milestones, changes secrets, repository settings and hardware, and sets the agent access level of an infra repo. Agents change a host only with devops infra, and only as far as the access level of its infra repo allows (SECURITY.md). The homelab repo is at full, because it exists to develop, troubleshoot and validate the features of the project." SECURITY.md gets a section ## Infra Repos with the levels, the guards, "Secrets and hardware stay with the owner at every level", and "The level stops an agent error; it is not a security boundary, because an agent with a shell can run ansible-playbook. So an agent changes a host only with devops infra, never with ansible-playbook, kubectl drain, make or a reboot over SSH."
Phases and build order
- Workstation (first): feat(infra): onboard an Ansible infra repo #5121 onboard (first slice), feat(infra): show the hosts of an infra repo with node state #5123 status, feat(infra): plan a playbook of an infra repo in check mode #5124 plan, feat(infra): apply a saved plan one node at a time #5125 apply + access levels + policy text, feat(infra): report drift of an infra repo #5127 drift, feat(infra): add node drain, uncordon, restart and reboot #5128 node. homelab: dan-petty/homelab#21 node facts, dan-petty/homelab#8 CI lint, dan-petty/homelab#1 host keys, dan-petty/homelab#22 declarative content only (supersedes dan-petty/homelab#9).
- Environment move (after phase 1). The comment of 2026-11-13 on this issue gives the corrected plan in 18 steps, with the check, the rollback and the owner steps. Order: refactor(k8s): split the product dashboards and rules in place #5292 product split in place (plan step 2); docs(k8s): move the product README sections to docs/ #5293 README product sections to
docs/(step 3); refactor(k8s): read the environment tree from the infra repo #5131 PR 1, readers take the environment tree from the profile factkubernetes.dirand resolve a source by its repoURL (step 4; its fixture PR comes before step 17); fix(k8s): deploy-stack fetches a private Application repo #5294deploy-stackfetches a private Application repo (step 5); release vX with steps 2-5 (step 6); feat(argocd): read the environment from the homelab repo #5134 step 1, the owner adds the repository credential and installs the App (step 7); feat(argocd): read the environment from the homelab repo #5134 step 2 with feat(security): refuse a diff that names the configured domain #5295, the private-domain guard (step 8); dan-petty/homelab#23 homelab receives the environment files and their CI (step 9); feat(argocd): read the environment from the homelab repo #5134 Argo CD cutover, supersedes feat(k8s): Read homelab config from in-cluster Gitea, drop overrides #1291 (steps 10-15); feat(k8s): run the environment checks in homelab CI #5296 homelab environment checks (step 16); feat(argocd): read the environment from the homelab repo #5134 step 6 deletes the environment files from devops-cli (step 17); build(k8s): pin the product base to a release tag #5135 product source pinned to a release tag after the cutover (step 18). - Cluster (later, ADR 0021): feat(infra): run drift in the cluster and plan infra PRs #5129 drift CronWorkflow and PR plan comments, feat(infra): apply a merged infra PR in a step job #5130 apply a merged infra PR in a step job.
Live validation on homelab: onboarding from an empty config (#5121); plan of 03_k3s.yaml on <gpu-node> shows the 2 changes of the owner's check run (#5124); apply dan-petty/homelab#19 on each of the 4 nodes one at a time and 13_crash_capture.yaml on <gpu-node> (#5125); reboot <gpu-node> so kdump reserves memory (#5128).
Target Subsystem
OpenTofu / Infrastructure as Code
Existing Tool Considered
ansible-runner (chosen). Rejected: ansible-playbook with the ansible.posix.jsonl callback (we would build the run folder, events and timeouts: about 1.5M tokens and 3 hours more); ansible-navigator (a TUI for execution-environment containers); AWX (a second control plane, no release since 2024-07-02); Semaphore (a second stateful service and secret store); kured and system-upgrade-controller (reboot or k3s upgrade only; revisit later); an own SSH executor (about 15M tokens). Total build of all items about 40M tokens and 58 hours.
Acceptance Criteria
- Every sub-issue is closed.
- An agent applies a plan on dan-petty/homelab at level
fullwithdevops infra apply, with nomakecommand and no raw reboot.
Dependencies
#3767 (devops pr create and devops pr ready for a repo with no OpenSpec and no CI; every homelab item needs it); dan-petty/homelab#1 (host key checks, needed for agent applies).
Alternatives check of 2026-11-27: in-use.
The repository already uses this tool.
Tool: ansible/ansible-runner (https://github.com/ansible/ansible-runner), NOASSERTION, last activity 2026-11-12, maintained.
Reason: Searches and repository facts confirm ansible-runner is the maintained Ansible execution engine the issue already names; it runs playbooks with run folders, job events and timeouts, but onboarding, plan/apply guards, drift and node life cycle stay custom.
Covers:
- Runs a playbook in its own run folder with artifacts
- Emits job events, timeouts and a remote execution mode
- Keeps ansible-core in its own process, outside devops environment guards
Lacks:
- No inventory join with node state or SSH ping status
- No check-mode plan hash, diff or disruptive-task classification
- No agent access levels, drift gauge, audit record or node drain/reboot gates
Activity
dan-petty commentedon Nov 12, 2026
Both items work in the devops-cli project and touch k8s, but #1225 deploys devops workloads while this candidate adds Ansible-based infra repo management.8 remaining items
dan-petty commentedon Nov 13, 2026
Corrected plan for phase 2 (2026-11-13)
The owner approved phase 2 of the corrected plan and accepted the 11 owner-step recommendations on 2026-11-13. The plan was checked against devops-cli origin/main
7a158c4c3, homelab origin/main19f0457and the live cluster, read only. At the cutover, the plan keeps the behaviour of today: Applicationdevopsreads devops-clik8s/devopsonmain, and the product ref of Applicationprometheusreadsmain. The release-tag pin of #5135 comes after the cutover. Public evidence holds exit codes and counts only, never diff output or Application YAML.Order of work
docs/kubernetes.dir, foreign-source support) before S; the fixture PR before step 17deploy-stackfetch of a private Application reporelease-merge.ymlsourceRepos, runbook) with #5295 private-domain guardOwner steps (decided 2026-11-13)
devops-cli-argocd(Contents: read) is installed on homelab. The owner creates the Argo CD repository credential object. No deploy key. Before step 11.devops-cli-argocd(Deployments: write) on homelab before step 11..pre-commit-config.yamlwith the pre-commit-hooks hookno-commit-to-branch(branchmain). It gets no branch protection, no ruleset, no required check and no other gate that blocks or delays work. The step 16 environment checks are advisory: they report on each pull request and never block a merge or an apply.git log S -- <path>in devops-cli gives the old history.k8s/cloudflaredin the Tunnel group) is the one definition of the tunnel. dan-petty/homelab#23 deletesk8s/manifests/cloudflared.yamland changes the Makefile targettunnel: it only creates or rotates thecloudflared-tunnel-tokenSecret from$CLOUDFLARE_TUNNEL_TOKENand restarts the Deployment. It no longer applies a manifest. The token stays out of git.main.release-merge.yml.New sub-issues of #5120
refactor(k8s): split the product dashboards and rules in place(step 2)docs(k8s): move the product README sections to docs/(step 3)fix(k8s): deploy-stack fetches a private Application repo(step 5)feat(security): refuse a diff that names the configured domain(step 8)feat(k8s): run the environment checks in homelab CI(step 16; the work is in homelab)The bodies of #5120, #5131, #5134, #5135 and dan-petty/homelab#23 now give this order, the checks and the dependencies.
refactor(k8s): split the product dashboards and rules in place (#5309)
docs(k8s): move the product README sections to docs/CLUSTER.md
docs(k8s): move the product README sections to docs/CLUSTER.md (#5312)
fix(k8s): deploy-stack fetches a private Application repo (#5331)
refactor(k8s): read the environment tree from the infra repo (#5334)
dan-petty commentedon Nov 13, 2026
Scope from the spec split (2026-11-13)
The Kubernetes spec (PR #5492) loses its node table (Table 1) in the split (owner directions of 2026-11-13), and the Kubernetes guideline links
devops infra statusfor the node facts. Please add these columns todevops infra status, from the node object that the command already reads:status.nodeInfo.containerRuntimeVersion);nvidia.com/gpu.product);nvidia.com/gpu.total-vram-gib,nvidia.com/gpu.architecture);status.runtimeHandlers), so the gVisor nodes show.The command shows the GPU count today, and #5123 is closed, so this is new scope for this tracker.
devops-cli-service commentedon Nov 16, 2026
Alternatives check: in-use
Reason: The issue already names ansible-runner as the chosen execution engine for the new
devops infracommand group, and ansible-runner (Apache-2.0, v2.4.3, active) covers that engine part — running Ansible playbooks with job events, a per-run folder, timeouts and a remote mode. But it does not cover the issue's broader need: onboarding infra repos, status joined with Kubernetes node state, plan hashing and per-host disruptive detection, apply guards (one disruptive node at a time, health gates), drift, node lifecycle (drain/uncordon/restart/reboot) and agent access levels, which the issue builds itself in the devops CLI.The repository already uses this tool.
Tool: ansible/ansible-runner (https://github.com/ansible/ansible-runner)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 21, 2026
Infra repos plan of 2026-11-21 (ADR 0032, #6674): dan-petty/infra holds the shared templates (the service repository GitOps template and tenant chart, the External Secrets Operator templates, the Valkey base, Kustomize components, values templates of the platform stacks, the Ansible collection, the OpenTofu modules, the Renovate presets and a reusable check workflow). homelab holds the instances, the services entries and the sensitive values, and later the definitions of the environment Secret rows (dan-petty/homelab#96, #6685). devops-cli keeps its own deployment (k8s/devops) and the product code. The items fit #5134 as approved: each homelab switch waits for plan step 12 and homelab#38.
devops-cli-service commentedon Nov 22, 2026
The result in the alternatives block of the issue body changed. Before this check:
in-use, tool https://github.com/ansible/ansible-runner. A person decides what the new result means for the item.Searches (7)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 27, 2026
The result in the alternatives block of the issue body changed. Before this check:
in-use, tool https://pypi.org/project/ansible-runner. A person decides what the new result means for the item.Searches (6)
Tools considered:
Searches run:
Sources: