Repository navigation
Description
Problem or Motivation
The owner asked on 2026-11-12 for native devops commands that manage an infrastructure environment kept in a git repo, first dan-petty/homelab. That repo holds an Ansible inventory, playbooks and roles. Today a person runs make targets of that repo by hand, and agents give the owner make commands. Every later devops infra command (status, plan, apply, drift, node) needs to know which repos are infra repos, where they are, how their Ansible content is laid out, and the agent access level of each. Nothing records this now. The owner also asked (2026-11-12) to use the homelab repo to validate the onboarding of an infra repo.
Proposed Solution & Architectural Design
Design: .data/agent/scratch/infra-repo/DESIGN.md (sections 1, 3, 4, 5) of the filing session; the tracker #5120 holds the summary.
- Settings. A new
infrasection:plan_max_age_hours,drain_timeout_seconds,node_ready_timeout_seconds, andrepos, a list of entries withrepo(aRepoRef),path(default<repos.base_dir>/<owner>/<name>),kind(ansible),kube_context,ssh_key_prefix(defaultansible),agent_access(none,plan,safeorfull; defaultnone),purpose(free text) andk8s_dir(default none). The field description ofagent_accesssays what each level lets an agent do. - Tool pin. A
[python.ansible]entry insrc/devops_cli/tools_lock/tools.lockwith hashed requirements foransible-coreandansible-runner(entry pointsansible-runner,ansible-playbook,ansible,ansible-inventory,ansible-config,ansible-galaxy).devops install-toolsinstalls it. Not apyproject.tomldependency: ansible-core is GPL-3.0-or-later and runs only as a separate process. devops infra onboard <repo>(a GitHub name or a local path). It reads only the local checkout and local tool output:ansible-config dump --format json(inventory and roles path, host key settings),ansible-inventory --list(groups and hosts), the playbook files,collections/requirements.yml, and thedevops_infra_inventory variables through thedebugaction plugin (no SSH). It prints one row for each check, with a state, a reason and a step, asdevops roadmap onboarddoes (src/devops_cli/roadmap/onboard.py): tool environment present,devops sshkey of the prefix present, each in-service host in~/.ssh/known_hosts, host key checks on, kube context present, CI workflow present,offlinegroup present, collections pinned, tasks withcheck_mode: false(listed, because they run during a plan), per-host Makefile targets thatdevops infra nodereplaces.--confirmwrites the settings entry withsave_settings, at levelnoneunless--agent-access <level>is given. An agent caller (detect_agent,AI_AGENT, MCP) cannot give a level abovenone: the command refuses and names the setting.--dry-runmakes zero requests and lists the commands that a real run starts.- A new command group
devops infra, withonboardas its first command. Docs: the generated command reference and README settings.
Target Subsystem
OpenTofu / Infrastructure as Code
Existing Tool Considered
Ansible's own tools give the facts: ansible-config dump --format json and ansible-inventory --list. ansible-runner (Apache-2.0, 2.4.3) is the engine of the later commands, chosen over ansible-navigator, AWX (no release since 2024-07-02) and Semaphore (a second stateful service and secret store); see the tracker. The onboarding rows are glue around those tools. Cost: about 2.5M tokens to build, 0.3M tokens a quarter to keep, 4 hours.
Acceptance Criteria
- Tests with a fixture repo that copies the shape of dan-petty/homelab (groups
k3s_cluster,k3s_server,k3s_agent,gpu_nodes,debian_nodes,offline; host_vars; playbooks00-12,site.yaml,health_check.yaml) withexample.comhosts and RFC 5737 addresses: every row of the report, for a complete repo and for a repo that lacks each item. - A test: a repo entry with no
agent_accessreads asnone. - A test: an agent caller with
--agent-access full --confirmis refused, and no file changes. - A test:
--dry-runstarts no process and sends no request. -
devops install-toolsinstalls the pinned[python.ansible]environment, andansible-runner --versionruns from it. - Live run on dan-petty/homelab from an empty config:
DEVOPS_CLI_CONFIG=<empty file> uv run devops infra onboard dan-petty/homelab, then the same with--confirm. The report and the resulting settings entry (levelnone) are in a PR comment, not in a committed file. The report shows at least: host key checks off (dan-petty/homelab#1), no CI (dan-petty/homelab#8), nocollections/requirements.yml, and the per-host Makefile targets. - The PR body gives the owner's step to set homelab to
full:uv run devops infra onboard dan-petty/homelab --agent-access full --confirm.
Dependencies
None. This is the first slice of #5120.
Activity
dan-petty commentedon Nov 12, 2026
Both manage infra repos via devops infra, but #5120 tracks all infra commands while the candidate delivers only the onboard command and its settings and tool pin.devops-cli-service commentedon Nov 12, 2026
Released in v0.121.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.121.0
devops-cli-service commentedon Nov 12, 2026
Live since 2026-11-12 17:54 UTC