Skip to content

Refactor Ansible pi_agent/plannotator vars to shared base + host-local combine - #106

Merged
boga merged 1 commit into
masterfrom
refactor-vars
Jul 21, 2026
Merged

Refactor Ansible pi_agent/plannotator vars to shared base + host-local combine#106
boga merged 1 commit into
masterfrom
refactor-vars

Conversation

@boga

@boga boga commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Why

MCP servers, settings overrides, subagent overrides, and plannotator thinking
levels were duplicated (or partially duplicated) across group_vars/all.yml
and host_vars/{home,work}/vars.yml. One entry (pi_agent_mcp_servers) even
carried an explicit comment warning that work redefines the whole dict in
full and must be kept manually in sync — a drift risk on every future edit.

Approach

Reused the existing combine(recursive=True) pattern already used elsewhere
in this repo: a *_base dict in group_vars/all.yml holding values shared
across hosts, and an optional *_local dict per host_vars file holding only
the deltas. The final var is computed once in group_vars/all.yml via
hostvars[inventory_hostname].get('..._local', {}), so hosts that don't
override anything just omit the _local var.

Considered leaving per-host vars fully duplicated (status quo) but rejected it
since it's exactly the kind of drift the MCP servers comment already flagged.

How it works

  • pi_agent_mcp_servers_base (context-mode, context7, intellij-idea) +
    per-host pi_agent_mcp_servers_local (work adds notion/new-relic/linear/n8n).
  • pi_agent_settings_overrides_base (collapseChangelog,
    enableInstallTelemetry) + per-host pi_agent_settings_overrides_local
    (enabledModels), rendered back to a JSON string via to_json since
    roles/pi_agent/tasks/settings.yml still expects a JSON string it can
    from_json at apply time.
  • pi_agent_subagent_overrides_base (thinking levels identical on both hosts
    today) + per-host pi_agent_subagent_overrides_local (model assignments and
    extra per-agent fields like maxExecutionTimeMs/defaultContext), merged
    recursively so per-agent dicts combine field-by-field rather than replace.
  • pi_plannotator_thinking_base (planning/executing/reviewing levels,
    identical on both hosts today) + a pi_plannotator_thinking_local hook for
    future per-host deviation; pi_plannotator_*_model stay host-specific since
    they differ entirely per host (openai-codex vs anthropic).

Verified the merged output for both hosts matches the pre-refactor values
exactly (simulated the combine + to_json logic), and confirmed yamllint /
ansible-lint report no new violations. Also restored
ansible_python_interpreter in host_vars/home/vars.yml, which had been
accidentally commented out.

Consumer-facing variable names (pi_agent_mcp_servers,
pi_agent_settings_overrides, pi_agent_subagent_overrides,
pi_plannotator_*_thinking) are unchanged, so site.yml, the pi_agent/git/
config_files/cp roles, and templates/pi/plannotator.json all resolve the
same final values with no code changes needed.

Links

  • N/A

Summary by CodeRabbit

  • New Features
    • Added flexible host-specific configuration overrides for MCP servers, agent settings, subagents, and planning workflows.
    • Added shared defaults for subagent and planning “thinking” levels, with convenient planning, execution, and review settings.
    • Added IntelliJ IDEA MCP project-path header support.
    • Updated host configurations to support per-subagent models and execution settings.

…+local combine

MCP servers, settings overrides, subagent overrides, and plannotator
thinking levels were duplicated (or partially duplicated) across
group_vars/all.yml and host_vars/{home,work}/vars.yml. Split each into
a *_base (group_vars) and *_local (host_vars) dict, merged via
combine(recursive=True), so shared values live in one place and hosts
only declare their deltas.

Also restores ansible_python_interpreter in host_vars/home/vars.yml,
which had been accidentally commented out.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 48808ccf-c08a-4266-9515-ea41841ffca5

📥 Commits

Reviewing files that changed from the base of the PR and between e527f08 and 48d6d4b.

📒 Files selected for processing (3)
  • group_vars/all.yml
  • host_vars/home/vars.yml
  • host_vars/work/vars.yml

📝 Walkthrough

Walkthrough

Ansible Pi agent configuration now combines shared base values with host-local overrides for MCP servers, agent settings, subagent behavior, and Plannotator thinking levels. Home and work hosts provide their configurations through the new local override variables.

Changes

Pi agent configuration

Layer / File(s) Summary
Shared configuration composition
group_vars/all.yml
MCP servers, agent settings, subagent defaults, and Plannotator thinking values now derive from base maps merged with optional host-local overrides.
Home host overrides
host_vars/home/vars.yml
Home defines local Codex subagent and enabled-model overrides, plus explicit Plannotator model provider and ID values.
Work host overrides
host_vars/work/vars.yml
Work defines local subagent, MCP, and enabled-model overrides, including per-subagent resource and context settings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main refactor: moving pi_agent/plannotator vars to shared base values with host-local combines.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor-vars

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@boga boga changed the title refactor(vars): dedupe host-shared pi_agent/plannotator vars via base… Refactor Ansible pi_agent/plannotator vars to shared base + host-local combine Jul 21, 2026
@boga
boga marked this pull request as ready for review July 21, 2026 08:32
@boga
boga merged commit 2396849 into master Jul 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant