From c8f19ed9188612688bde8141d48b7e5d60a8c753 Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Sat, 19 Sep 2026 21:41:50 +0200 Subject: [PATCH] Only restart samba when its config changes 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 --- roles/pi_musicmouse/handlers/main.yml | 6 ++++++ roles/pi_musicmouse/tasks/main.yml | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/pi_musicmouse/handlers/main.yml b/roles/pi_musicmouse/handlers/main.yml index dc32403..d7bc8f6 100644 --- a/roles/pi_musicmouse/handlers/main.yml +++ b/roles/pi_musicmouse/handlers/main.yml @@ -34,3 +34,9 @@ state: restarted enabled: "yes" daemon_reload: "yes" + +- name: Restart samba + ansible.builtin.systemd: + name: smbd + state: restarted + daemon_reload: true diff --git a/roles/pi_musicmouse/tasks/main.yml b/roles/pi_musicmouse/tasks/main.yml index 3c48707..b9f6b79 100644 --- a/roles/pi_musicmouse/tasks/main.yml +++ b/roles/pi_musicmouse/tasks/main.yml @@ -217,13 +217,13 @@ src: smb.conf dest: /etc/samba/ mode: "0644" + notify: Restart samba -- name: Restart samba +- name: Enable samba ansible.builtin.systemd: name: smbd - state: restarted - enabled: "yes" - daemon_reload: "yes" + state: started + enabled: true # manual steps: # - set samba passwords with smbpasswd # - copy music into /media/musicmouse: scripts/sync-library.sh in the app repo, which