state: restarted is unconditional, so every run reported a change and bounced smbd - which is the share the music is copied over, so a run during a transfer would interrupt it. Start/enable it as a task, restart it from a handler the config copy notifies. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
43 lines
1.2 KiB
YAML
43 lines
1.2 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"
|
|
|
|
- name: Restart samba
|
|
ansible.builtin.systemd:
|
|
name: smbd
|
|
state: restarted
|
|
daemon_reload: true
|