community.general.zfs (8.5.0) — module

Manage zfs

Authors: Johan Wiren (@johanwiren)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manages ZFS file systems, volumes, clones and snapshots

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a new file system called myfs in pool rpool with the setuid property turned off
  community.general.zfs:
    name: rpool/myfs
    state: present
    extra_zfs_properties:
      setuid: 'off'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a new volume called myvol in pool rpool.
  community.general.zfs:
    name: rpool/myvol
    state: present
    extra_zfs_properties:
      volsize: 10M
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a snapshot of rpool/myfs file system.
  community.general.zfs:
    name: rpool/myfs@mysnapshot
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a new file system called myfs2 with snapdir enabled
  community.general.zfs:
    name: rpool/myfs2
    state: present
    extra_zfs_properties:
      snapdir: enabled
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a new file system by cloning a snapshot
  community.general.zfs:
    name: rpool/cloned_fs
    state: present
    origin: rpool/myfs@mysnapshot
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Destroy a filesystem
  community.general.zfs:
    name: rpool/myfs
    state: absent

Inputs

    
name:
    description:
    - File system, snapshot or volume name, for example V(rpool/myfs).
    required: true
    type: str

state:
    choices:
    - absent
    - present
    description:
    - Whether to create (V(present)), or remove (V(absent)) a file system, snapshot or
      volume. All parents/children will be created/destroyed as needed to reach the desired
      state.
    required: true
    type: str

origin:
    description:
    - Snapshot from which to create a clone.
    type: str

extra_zfs_properties:
    default: {}
    description:
    - A dictionary of zfs properties to be set.
    - See the zfs(8) man page for more information.
    type: dict