arensb.truenas.pool_scrub_task module – Schedule periodic scrub of ZFS pools.

Note

This module is part of the arensb.truenas collection (version 1.11.4).

To install it, use: ansible-galaxy collection install arensb.truenas.

To use it in a playbook, specify: arensb.truenas.pool_scrub_task.

New in arensb.truenas 1.8.0

Synopsis

  • Schedule periodic ZFS pool scrub tasks.

Parameters

Parameter

Comments

day

aliases: date, dom

string

Day of month when the task should run, in cron format.

This is a comma-separated list of integer ranges, e.g., “10”, “1-5”, “1,3,7-10”.

description

string

Optional description of this task.

enabled

boolean

Whether the task should be enabled

Choices:

  • false

  • true

hour

string

Hour when the task should run, in cron format.

This is a comma-separated list of integer ranges.

minute

string

This parameter is ignored, and exists only for compatibility with builtin.cron.

month

string

Month when the task should run, in cron format.

This is a comma-separated list of month names or numbers, e.g., “jan,feb,mar”.

pool

string / required

Name of the pool to scrub.

Only one scrub task is allowed per pool.

state

string

Whether the scrub should exist or not.

Choices:

  • "absent"

  • "present" ← (default)

threshold

integer

Minimum number of days between successful scrub tasks.

For instance, if you schedule a job to run every day, but set threshold to 7, the job will check every day to see whether it should run, but will only actually run once every 7 days.

weekday

aliases: dow

string

Day of week when the task should run, in cron format.

This is a comma-separated list of day numbers of abbreviations, e.g. “1”, “1,5”, “sun,mon”.

Examples

- name: Create a default periodic scrub task.
  hosts: zfs_host
  become: yes
  tasks:
    - arensb.truenas.pool_scrub_task:
      pool: tank

- name: Create a weekly task with a 35-day threshold
  hosts: zfs_host
  become: yes
  tasks:
    - arensb.truenas.pool_scrub_task:
      pool: tank
      description: Test weekly, scrub monthly.
      threshold: 35
      hour: "3"
      day: "*"
      month: "*"
      weekday: "tue"

- name: Delete an existing scrub task.
  hosts: zfs_host
  become: yes
  tasks:
    - arensb.truenas.pool_scrub_task:
      pool: tank
      state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

task

string

A structure describing a newly-created task.

Returned: success