From 612e5abff670bbd7510521cd850aeb3fbd71375f Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Thu, 1 Feb 2024 22:12:39 +0100 Subject: [PATCH] sanoid: set timezone (#716) Reviewed-on: https://git.mgrote.net/mg/homeserver/pulls/716 Co-authored-by: Michael Grote Co-committed-by: Michael Grote --- group_vars/fileserver.yml | 2 +- playbooks/3_service/fileserver.yml | 2 +- roles/mgrote_fileserver_smb/defaults/main.yml | 8 ++++---- roles/mgrote_fileserver_smb/templates/smb.conf.j2 | 3 ++- roles/mgrote_zfs_sanoid/tasks/snaps.yml | 11 ++++------- roles/mgrote_zfs_sanoid/templates/overrides.j2 | 6 ++++++ roles/mgrote_zfs_sanoid/templates/sanoid.conf.j2 | 2 -- 7 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 roles/mgrote_zfs_sanoid/templates/overrides.j2 diff --git a/group_vars/fileserver.yml b/group_vars/fileserver.yml index 9eeecaae..5ccc4856 100644 --- a/group_vars/fileserver.yml +++ b/group_vars/fileserver.yml @@ -23,4 +23,4 @@ smb_workgroup: WORKGROUP smb_min_protocol: "SMB2" smb_client_min_protocol: "SMB2" smb_client_max_protocol: "SMB3_11" -smb_enable_snapshots_dir: true +smb_enable_snapshots_dir: false diff --git a/playbooks/3_service/fileserver.yml b/playbooks/3_service/fileserver.yml index a6b4d769..399ac160 100644 --- a/playbooks/3_service/fileserver.yml +++ b/playbooks/3_service/fileserver.yml @@ -6,6 +6,6 @@ --- - hosts: fileserver roles: - - { role: mgrote_fileserver_smb, tags: "fileserver_smb" } + - { role: mgrote_fileserver_smb, tags: "smb" } - { role: mgrote_youtubedl, tags: "youtubedl" } - { role: mgrote_disable_oom_killer, tags: "oom" } diff --git a/roles/mgrote_fileserver_smb/defaults/main.yml b/roles/mgrote_fileserver_smb/defaults/main.yml index 166b4d02..6b8bb194 100644 --- a/roles/mgrote_fileserver_smb/defaults/main.yml +++ b/roles/mgrote_fileserver_smb/defaults/main.yml @@ -83,16 +83,16 @@ smb_packages: ## sorgt dafur das statt "A0KDC9~F" die Ordnernamen als "autosnap_2021-11-04_23÷59÷02_daily" angezeigt werden ## https://www.samba.org/samba/docs/current/man-html/vfs_catia.8.html # aktiv? -smb_enable_snapshots_dir: true +smb_enable_snapshots_dir: false # welche Character/zeichen-Ersetzungen soll catia ausführen smb_catia_mappings: "0x3a:0xf7" # ersetzt ":" durch "÷" # als Windows-Shattenkopien einbinden ## https://www.samba.org/samba/docs/current/man-html/vfs_shadow_copy2.8.html ## BUG: Windows sieht die Schattenkopien, kann die Ausgewählte Datei aber nicht öffnen wenn sie seit dem Snapshot gelöscht wurde, vmtl da Windows nicht den kompletten Snapshot-Pfad verwendet -## Format ist passend fur sanoid-Snapshots +## Format ist passend für sanoid-Snapshots # aktiv? -smb_enable_snapshots_shadow: false +smb_enable_snapshots_shadow: true # wo liegen die Snapshots smb_shadow_snapdir: ".zfs/snapshot" # Sortierung @@ -104,4 +104,4 @@ smb_shadow_snapprefix: "^autosnap" # Snapshot-"Trenner" smb_shadow_delimiter: "_" # zeitformat Snapshots -smb_shadow_localtime: "no" +smb_shadow_localtime: "yes" diff --git a/roles/mgrote_fileserver_smb/templates/smb.conf.j2 b/roles/mgrote_fileserver_smb/templates/smb.conf.j2 index de48d34c..5b35c8c3 100644 --- a/roles/mgrote_fileserver_smb/templates/smb.conf.j2 +++ b/roles/mgrote_fileserver_smb/templates/smb.conf.j2 @@ -24,7 +24,7 @@ shadow: localtime = {{ smb_shadow_localtime }} #======================= vfs objects ======================= vfs objects = shadow_copy2, catia ##======================= catia ======================= -catia: mappings = {{ smb_catia_mappings }} +catia:mappings = {{ smb_catia_mappings }} ##======================= shadow_copy2 ======================= shadow: snapdir = {{ smb_shadow_snapdir }} shadow: sort = {{ smb_shadow_sort }} @@ -32,6 +32,7 @@ shadow: format = {{ smb_shadow_format }} shadow: snapprefix = {{ smb_shadow_snapprefix }} shadow: delimiter = {{ smb_shadow_delimiter }} shadow: localtime = {{ smb_shadow_localtime }} +shadow: snapdirseverywhere = yes {% endif %} diff --git a/roles/mgrote_zfs_sanoid/tasks/snaps.yml b/roles/mgrote_zfs_sanoid/tasks/snaps.yml index 86e3ab6f..5a6b6aac 100644 --- a/roles/mgrote_zfs_sanoid/tasks/snaps.yml +++ b/roles/mgrote_zfs_sanoid/tasks/snaps.yml @@ -19,17 +19,14 @@ notify: - systemctl daemon-reload -- name: add sanoid_mail.service to sanoid.service +- name: add overrides (sanoid_mail + TZ) become: true - ansible.builtin.blockinfile: - create: true + ansible.builtin.template: + src: "overrides.j2" mode: "0644" owner: root group: root - path: /lib/systemd/system/sanoid.service.d/override.conf - block: | - [Unit] - OnFailure = sanoid_mail.service + dest: /lib/systemd/system/sanoid.service.d/override.conf notify: - systemctl daemon-reload diff --git a/roles/mgrote_zfs_sanoid/templates/overrides.j2 b/roles/mgrote_zfs_sanoid/templates/overrides.j2 new file mode 100644 index 00000000..e9033464 --- /dev/null +++ b/roles/mgrote_zfs_sanoid/templates/overrides.j2 @@ -0,0 +1,6 @@ +{{ file_header | default () }} + +[Unit] +OnFailure = sanoid_mail.service +[Service] +Environment=TZ=Europe/Berlin diff --git a/roles/mgrote_zfs_sanoid/templates/sanoid.conf.j2 b/roles/mgrote_zfs_sanoid/templates/sanoid.conf.j2 index 9796d030..26fa7f80 100644 --- a/roles/mgrote_zfs_sanoid/templates/sanoid.conf.j2 +++ b/roles/mgrote_zfs_sanoid/templates/sanoid.conf.j2 @@ -7,8 +7,6 @@ ## -------------------------------------------- ## {% endfor %} - - ## Template Section --------------------------- ## {% for item in sanoid_templates %} [template_{{ item.name }}]