Files
ansible/roles/pi_musicmouse/defaults/main.yml
Martin Bauer 6fcc345a26 Only rebuild the venv when the deployed commit changes
The previous fix made the install convergent but not idempotent: it keyed
"changed" off uv printing "Installed", and uv prints that every single run.
musicmouse is a local path dependency, so uv rebuilds and reinstalls it every
time regardless. Every ansible run therefore restarted the service and made it
rescan the whole library for nothing.

Decide from the device instead: the commit the checkout landed on, recorded in
the venv, plus whether the venv can import the package at all. That keeps the
convergence the handler lacked - an empty venv reinstalls even when the commit
matches - without touching anything on a run where nothing moved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 21:13:00 +02:00

50 lines
2.5 KiB
YAML

---
pi_musicmouse_repo: "ssh://git@git.bauer.tech:2222/martin/musicmouse.git"
# No default on purpose: which branch to run is a per-host decision, set in host_vars.
# The deploy/<host> branches on the remote are the intended values - move one with
# `git push -f origin <branch>:deploy/musicdolphin` and re-run this role.
# musicmouse_version: "deploy/musicdolphin"
pi_musicmouse_python_version: "3.13"
pi_musicmouse_uv_version: "0.12.10"
# Which uv build to download. Raspberry Pi OS ships a 64-bit kernel with a 32-bit
# userland, so `uname -m` (and therefore ansible_architecture) says aarch64 on a box
# that can only run armhf binaries - the aarch64 build installs fine and then fails to
# exec with "No such file or directory", which is the dynamic loader missing, not the
# file. ansible_userspace_bits is the fact that tells the truth.
pi_musicmouse_uv_target: >-
{{ 'armv7-unknown-linux-gnueabihf'
if (ansible_architecture in ['aarch64', 'armv7l', 'armv6l'] and ansible_userspace_bits == '32')
else _pi_musicmouse_uv_targets[ansible_architecture] }}
_pi_musicmouse_uv_targets:
aarch64: aarch64-unknown-linux-gnu
armv7l: armv7-unknown-linux-gnueabihf
armv6l: armv7-unknown-linux-gnueabihf
x86_64: x86_64-unknown-linux-gnu
# Where to check out the repo on the *control machine* to build the frontend (npm isn't
# installed on the Pi - see README). Keyed by version so different hosts on different
# versions don't clobber each other's build.
pi_musicmouse_build_cache: "/tmp/musicmouse-build-cache"
# Which files/config-*.yml to install as this host's /media/musicmouse/config.yml.
pi_musicmouse_config_file: "config-{{ inventory_hostname }}.yml"
# The app owns config.yml at runtime: parent mode writes the volume keys back to it, and
# the remote-control page rewrites its `remote:` block. So the config is installed once
# and then left alone, or every ansible run would silently undo those edits. Push a
# changed config deliberately:
#
# just run mediapis.yml musicdolphin -e pi_musicmouse_force_config=true
pi_musicmouse_force_config: false
# The typing game's lesson plan, installed next to config.yml. A config with a `tippen:`
# section will not start without it - curriculum_file is validated as must-exist. Set to
# "" for a host whose config has no tippen section.
pi_musicmouse_curriculum_file: "tippen-curriculum.yml"
# The commit the checkout task actually landed on, used to decide whether the venv
# needs rebuilding. Empty under --check, where the git task reports without writing.
pi_musicmouse_commit: "{{ pi_musicmouse_checkout.after | default('') }}"