pi_standard_setup's defaults set `ansible_become: true`. Role defaults are
play-wide host variables, and in Ansible's precedence the `ansible_become`
variable outranks the `become` keyword - so the `become: false` on every
pi_musicmouse task delegated to localhost was silently overridden and each one
tried to sudo on the machine running ansible:
Premature end of stream waiting for become success or become password prompt
Those defaults earn their keep bootstrapping a fresh Pi, where you connect as
`pi` and become root to enable root login, so override the variable on the
delegated tasks rather than removing them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
---
|
|
- name: Reinstall musicmouse backend
|
|
ansible.builtin.command:
|
|
cmd: "/usr/local/bin/uv pip install --python /opt/musicmouse/.venv/bin/python /opt/musicmouse/python-backend"
|
|
changed_when: true
|
|
notify: Restart musicmouse
|
|
|
|
- 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"
|