From 0901e98181e88d000296a6264993f1c7eeda07a5 Mon Sep 17 00:00:00 2001 From: mg Date: Mon, 12 Apr 2021 20:55:37 +0200 Subject: [PATCH] ZFS-Scrub (#69) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Syntax Variabgle monat ergänzt, scrub jetzt jeden 2. monat am 14. Sanoid cron kann jetzt dom(day of month) Vars trim entfernt Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/69 Co-Authored-By: mg Co-Committed-By: mg --- host_vars/pve2-test.grote.lan.yml | 22 +++++++++------------- host_vars/pve2.grote.lan.yml | 18 ++++++++---------- host_vars/pve3-test.grote.lan.yml | 10 ++++------ host_vars/pve3.grote.lan.yml | 10 ++++------ host_vars/pve4-test.grote.lan.yml | 10 ++++------ host_vars/pve4.grote.lan.yml | 10 ++++------ roles/mgrote.zfs_scrub/README.md | 1 + roles/mgrote.zfs_scrub/tasks/main.yml | 8 +++++--- 8 files changed, 39 insertions(+), 50 deletions(-) diff --git a/host_vars/pve2-test.grote.lan.yml b/host_vars/pve2-test.grote.lan.yml index 78fea122..742be899 100644 --- a/host_vars/pve2-test.grote.lan.yml +++ b/host_vars/pve2-test.grote.lan.yml @@ -50,18 +50,14 @@ zfs_extra_arc_max_size: "2147483648" # 2GB in Bytes zfs_extra_zfs_pools: - name: "rpool" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "22" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "6" - cron_minutes_zfs_scrub: "0" + cron_minutes_zfs_scrub: "5" cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" - name: "hdd_vm_mirror" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "23" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "6" - cron_minutes_zfs_scrub: "0" - cron_hour_zfs_scrub: "22" + cron_minutes_zfs_scrub: "10" + cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" diff --git a/host_vars/pve2.grote.lan.yml b/host_vars/pve2.grote.lan.yml index d70088f7..da7d0d95 100644 --- a/host_vars/pve2.grote.lan.yml +++ b/host_vars/pve2.grote.lan.yml @@ -81,21 +81,19 @@ zfs_extra_max_usage_health: "90" zfs_extra_zfs_pools: - name: "rpool" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "22" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "*/21" cron_minutes_zfs_scrub: "0" cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" - name: "hdd_data_raidz" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "24" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "*/21" cron_minutes_zfs_scrub: "0" cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" + + ### mgrote.zfs_sanoid sanoid_datasets: - path: 'hdd_data_raidz/data_crypt' diff --git a/host_vars/pve3-test.grote.lan.yml b/host_vars/pve3-test.grote.lan.yml index 69e0c9c8..8f89cd74 100644 --- a/host_vars/pve3-test.grote.lan.yml +++ b/host_vars/pve3-test.grote.lan.yml @@ -38,13 +38,11 @@ zfs_extra_arc_max_size: "2147483648" # 2GB in Bytes zfs_extra_zfs_pools: - name: "rpool" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "22" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "6" - cron_minutes_zfs_scrub: "0" + cron_minutes_zfs_scrub: "15" cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" ### mgrote.apcupsd apcupsd_nis_master: false apcupsd_nis_master_hostname: pve2-test.grote.lan diff --git a/host_vars/pve3.grote.lan.yml b/host_vars/pve3.grote.lan.yml index fa711238..2e72ebde 100644 --- a/host_vars/pve3.grote.lan.yml +++ b/host_vars/pve3.grote.lan.yml @@ -38,13 +38,11 @@ zfs_extra_arc_max_size: "6442450944" # 6GB in Bytes zfs_extra_zfs_pools: - name: "rpool" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "22" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "*/21" - cron_minutes_zfs_scrub: "0" + cron_minutes_zfs_scrub: "20" cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" ### mgrote.apcupsd apcupsd_nis_master: false apcupsd_nis_master_hostname: pve2.grote.lan diff --git a/host_vars/pve4-test.grote.lan.yml b/host_vars/pve4-test.grote.lan.yml index 69e0c9c8..edef7bd0 100644 --- a/host_vars/pve4-test.grote.lan.yml +++ b/host_vars/pve4-test.grote.lan.yml @@ -38,13 +38,11 @@ zfs_extra_arc_max_size: "2147483648" # 2GB in Bytes zfs_extra_zfs_pools: - name: "rpool" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "22" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "6" - cron_minutes_zfs_scrub: "0" + cron_minutes_zfs_scrub: "25" cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" ### mgrote.apcupsd apcupsd_nis_master: false apcupsd_nis_master_hostname: pve2-test.grote.lan diff --git a/host_vars/pve4.grote.lan.yml b/host_vars/pve4.grote.lan.yml index fa711238..7894c888 100644 --- a/host_vars/pve4.grote.lan.yml +++ b/host_vars/pve4.grote.lan.yml @@ -38,13 +38,11 @@ zfs_extra_arc_max_size: "6442450944" # 6GB in Bytes zfs_extra_zfs_pools: - name: "rpool" - cron_minute_zfs_trim: "5" - cron_hour_zfs_trim: "22" - cron_month_zfs_trim: "4,8,12" - cron_day_zfs_trim: "2" - cron_weekday_zfs_scrub: "*/21" - cron_minutes_zfs_scrub: "0" + cron_minutes_zfs_scrub: "30" cron_hour_zfs_scrub: "23" + cron_day_of_month_zfs_scrub: "14" + cron_day_of_week_zfs_scrub: "*" + cron_month_zfs_scrub: "*/2" ### mgrote.apcupsd apcupsd_nis_master: false apcupsd_nis_master_hostname: pve2.grote.lan diff --git a/roles/mgrote.zfs_scrub/README.md b/roles/mgrote.zfs_scrub/README.md index c29189b8..2a5c2e46 100644 --- a/roles/mgrote.zfs_scrub/README.md +++ b/roles/mgrote.zfs_scrub/README.md @@ -9,4 +9,5 @@ Richtet regelmaessige Scrubs(jeden Sonntag) ein. ### Variablen + Defaults - see [defaults](./defaults/main.yml) +- see [default-filter](./tasks/main.yml)) - Variablen für mgrote.zfs_health/trim/scrub/zed/arc_mem/ sind zusammengefasst unter zfs_extra_* diff --git a/roles/mgrote.zfs_scrub/tasks/main.yml b/roles/mgrote.zfs_scrub/tasks/main.yml index f60ded4c..40646678 100644 --- a/roles/mgrote.zfs_scrub/tasks/main.yml +++ b/roles/mgrote.zfs_scrub/tasks/main.yml @@ -12,7 +12,9 @@ name: zfs-scrub - "{{ item.name }}" state: present job: "{{ zfs_extra_path_zpool }} scrub {{ item.name }}" - weekday: "{{ item.cron_weekday_zfs_scrub }}" - minute: "{{ item.cron_minutes_zfs_scrub }}" - hour: "{{ item.cron_hour_zfs_scrub }}" + month: "{{ item.cron_month_zfs_scrub | default('*') }}" + weekday: "{{ item.cron_day_of_week_zfs_scrub | default('7') }}" + day: "{{ item.cron_day_of_month_zfs_scrub | default('*/21') }}" + hour: "{{ item.cron_hour_zfs_scrub | default('23') }}" + minute: "{{ item.cron_minutes_zfs_scrub | default('30') }}" with_items: "{{ zfs_extra_zfs_pools }}"