The role left musicdolphin with an empty venv and a service crash-looping on
ModuleNotFoundError while ansible reported failed=0, because installing the
backend hung off a handler notified by the git checkout:
- the run where the checkout changed failed later on, so handlers never
flushed and the notification was dropped;
- the next run found the checkout already current, notified nothing, and
installed nothing.
Nothing ever converges from there. Make it an ordinary task that runs every
time - uv is fast when there is nothing to do, and its output says whether it
actually installed anything, so a restart is still only notified on a real
change. Give the frontend the same treatment with a cheap stat, since the build
chain has the identical hole and a device with no dist serves no UI.
Also add libjpeg-dev and zlib1g-dev: Raspberry Pi OS has a 32-bit userland,
Pillow publishes no armv7 wheel, and uv therefore builds it from source.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
37 lines
1.0 KiB
YAML
37 lines
1.0 KiB
YAML
---
|
|
- name: Build frontend
|
|
ansible.builtin.command:
|
|
cmd: npm ci
|
|
chdir: "{{ pi_musicmouse_build_cache }}/{{ musicmouse_version | regex_replace('/', '_') }}/web"
|
|
delegate_to: localhost
|
|
become: false
|
|
vars:
|
|
ansible_become: false # see the first delegated task in tasks/main.yml
|
|
changed_when: true
|
|
notify: Compile frontend
|
|
|
|
- name: Compile frontend
|
|
ansible.builtin.command:
|
|
cmd: npm run build
|
|
chdir: "{{ pi_musicmouse_build_cache }}/{{ musicmouse_version | regex_replace('/', '_') }}/web"
|
|
delegate_to: localhost
|
|
become: false
|
|
vars:
|
|
ansible_become: false # see the first delegated task in tasks/main.yml
|
|
changed_when: true
|
|
notify: Sync frontend
|
|
|
|
- name: Sync frontend
|
|
ansible.posix.synchronize:
|
|
src: "{{ pi_musicmouse_build_cache }}/{{ musicmouse_version | regex_replace('/', '_') }}/web/dist/"
|
|
dest: /opt/musicmouse/web/dist/
|
|
delete: true
|
|
notify: Restart musicmouse
|
|
|
|
- name: Restart musicmouse
|
|
ansible.builtin.systemd:
|
|
name: musicmouse
|
|
state: restarted
|
|
enabled: "yes"
|
|
daemon_reload: "yes"
|