state=present
name=zfsutils
-- name: setup /usr/local/sbin/zpool-scrub.sh file
+- name: remove outdated zpool-scrub configuration
tags:
- zfs
- template: >
- dest=/usr/local/sbin/zpool-scrub.sh
- group=root
- mode=0755
- owner=root
- src=zpool-scrub.sh.j2
-
-- name: setup /etc/cton.d/zpool-scrub file
- tags:
- cron
- - zfs
- template: >
- dest=/etc/cron.d/zpool-scrub
- group=root
- mode=0644
- owner=root
- src=cron.d_zpool-scrub.j2
+ file:
+ state: absent
+ path: "{{ item }}"
+ with_items:
+ - /usr/local/sbin/zpool-scrub.sh
+ - /etc/cron.d/zpool-scrub
+++ /dev/null
-# /etc/cron.d/zpool-scrub
-# ---
-# {{ ansible_managed }}
-# ---
-
-PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin/:/bin
-MAILTO={{ admin_email }}
-
-# m h dom mon dow user command
-
-{{ zfs_scrub_minute }} {{ zfs_scrub_hour }} * * {{ zfs_scrub_dayofweek }} root /usr/local/sbin/zpool-scrub.sh
+++ /dev/null
-#!/bin/bash
-# /usr/local/sbin/backup-script-wrapper
-# ---
-# {{ ansible_managed }}
-# ---
-
-NAME=$(basename "$0")
-
-pools=$(zpool list -H | cut -f1)
-if [ $? -ne 0 ]; then
- echo "$NAME: Failed to list ZFS pools, aborting!"
- exit 1
-fi
-if [ -z "$pools" ]; then
- # No pools found, nothing to do, ok.
- exit 0
-fi
-
-wait_for_scrub_done() {
- while true; do
- zpool status "$1" 2>/dev/null | fgrep 'scrub in progress' >/dev/null
- [ $? -eq 0 ] || return 0
- sleep 60
- done
-}
-
-echo "Scrubbing ZFS storage pools on $(hostname -f):"
-echo
-
-zpool list
-echo
-
-for pool in $pools; do
- echo "Scrubbing ZFS storage pool \"$pool\" ..."
- echo -n "Started: "; date
- zpool scrub "$pool"
- if [ $? -eq 0 ]; then
- wait_for_scrub_done "$pool"
- echo -n "Done: "; date
- else
- echo "Failed to start scrubbing!?"
- zpool scrub -s "$pool" >/dev/null 2>&1
- sleep 5
- fi
- echo
-done
-
-# Show status of ZFS storage pools
-zpool status