ansible-freshen fails on Linux: pipx module not in ansible venv + mac-only inventory runs on non-mac hosts #260

Open
opened 2026-06-07 05:26:30 +00:00 by coilysiren · 0 comments
Owner

Summary

coily exec ansible-freshen (read-only --check --diff) fails on a Linux host. Two distinct root causes surfaced during the run.

Repro

cd ~/projects/coilyco-flight-deck/infrastructure
coily exec ansible-freshen   # defaults to action=check

Host: Linux (uname -s = Linux, no /opt/homebrew).

Finding 1 — pipx task fails even in check mode (the hard blocker)

TASK [homebrew : Ensure pipx applications are present]
[ERROR]: Module failed: /home/kai/.../infrastructure/.venv/bin/python: No module named pipx
failed: [localhost] (item=python-kasa) cmd: ".venv/bin/python -m pipx list --include-injected --json"
PLAY RECAP: ok=6 changed=4 failed=1
make: *** [Makefile:97: ansible-freshen] Error 2

Root cause: the inventory pins ansible_python_interpreter: "{{ ansible_playbook_python }}" (ansible/inventory/hosts.yml), so the community.general.pipx module shells out to the uv ansible venv's python via python -m pipx. That venv has no pipx module (confirmed: no .venv/bin/pipx). The homebrew role comment (roles/homebrew/tasks/main.yml:50-51) says pipx is "backed by the brew pipx formula" — i.e. it expects the brew-installed pipx CLI, not a venv module.

Fix options:

  • Point the module at the brew pipx via executable: on the community.general.pipx task, or
  • Add pipx to the ansible uv venv deps (pyproject.toml) so python -m pipx resolves.

Finding 2 — Linux host runs the macOS-only path; verb overclaims host-branching

ansible/playbooks/freshen.yml targets hosts: mac, and ansible/inventory/hosts.yml puts localhost in the mac group with no OS branching. On this Linux box the homebrew role evaluated macOS casks (blender, docker-desktop, intellij-idea-ce, warp@preview, etc.) and referenced /opt/homebrew/bin/pip3. In --check these report changed speculatively; an apply run would fail since brew install --cask is macOS-only.

The ansible-freshen verb description in .coily/coily.yaml advertises it as "Host-branched mac/linux/windows", but the inventory + playbook implement mac only (matches AGENTS.md: "today: macOS Homebrew via the mac inventory group"). Either implement linux/windows groups + branched role vars, or correct the verb description to reflect mac-only reality.

Side note

The repo was 7 commits behind origin/main at run time; git pull --ff-only cleared it (coily refuses repo verbs on a stale tree). Not a bug, just noting the precondition.

## Summary `coily exec ansible-freshen` (read-only `--check --diff`) fails on a Linux host. Two distinct root causes surfaced during the run. ## Repro ``` cd ~/projects/coilyco-flight-deck/infrastructure coily exec ansible-freshen # defaults to action=check ``` Host: Linux (`uname -s` = `Linux`, no `/opt/homebrew`). ## Finding 1 — `pipx` task fails even in check mode (the hard blocker) ``` TASK [homebrew : Ensure pipx applications are present] [ERROR]: Module failed: /home/kai/.../infrastructure/.venv/bin/python: No module named pipx failed: [localhost] (item=python-kasa) cmd: ".venv/bin/python -m pipx list --include-injected --json" PLAY RECAP: ok=6 changed=4 failed=1 make: *** [Makefile:97: ansible-freshen] Error 2 ``` Root cause: the inventory pins `ansible_python_interpreter: "{{ ansible_playbook_python }}"` (`ansible/inventory/hosts.yml`), so the `community.general.pipx` module shells out to the **uv ansible venv's** python via `python -m pipx`. That venv has no `pipx` module (confirmed: no `.venv/bin/pipx`). The `homebrew` role comment (`roles/homebrew/tasks/main.yml:50-51`) says pipx is "backed by the brew `pipx` formula" — i.e. it expects the brew-installed `pipx` CLI, not a venv module. Fix options: - Point the module at the brew pipx via `executable:` on the `community.general.pipx` task, or - Add `pipx` to the ansible uv venv deps (`pyproject.toml`) so `python -m pipx` resolves. ## Finding 2 — Linux host runs the macOS-only path; verb overclaims host-branching `ansible/playbooks/freshen.yml` targets `hosts: mac`, and `ansible/inventory/hosts.yml` puts `localhost` in the `mac` group with no OS branching. On this Linux box the `homebrew` role evaluated macOS casks (blender, docker-desktop, intellij-idea-ce, warp@preview, etc.) and referenced `/opt/homebrew/bin/pip3`. In `--check` these report `changed` speculatively; an `apply` run would fail since `brew install --cask` is macOS-only. The `ansible-freshen` verb description in `.coily/coily.yaml` advertises it as "Host-branched mac/linux/windows", but the inventory + playbook implement mac only (matches `AGENTS.md`: "today: macOS Homebrew via the `mac` inventory group"). Either implement linux/windows groups + branched role vars, or correct the verb description to reflect mac-only reality. ## Side note The repo was 7 commits behind `origin/main` at run time; `git pull --ff-only` cleared it (coily refuses repo verbs on a stale tree). Not a bug, just noting the precondition.
Sign in to join this conversation.
No description provided.