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 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 21:41:50 +02:00
parent 1b5a5e2c1d
commit c8f19ed918
2 changed files with 10 additions and 4 deletions

View File

@@ -34,3 +34,9 @@
state: restarted
enabled: "yes"
daemon_reload: "yes"
- name: Restart samba
ansible.builtin.systemd:
name: smbd
state: restarted
daemon_reload: true

View File

@@ -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