ansible.builtin.zfs (v2.4.4.0-1) — module

Manage zfs

| "added in version" 1.1 of ansible.builtin"

Authors: Johan Wiren (@johanwiren)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.4.4.0.post1

Description

Manages ZFS file systems, volumes, clones and snapshots.

Usage examples

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

Inputs

    
name:
    description:
    - File system, snapshot or volume name e.g. C(rpool/myfs)
    required: true

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

origin:
    default: null
    description:
    - Snapshot from which to create a clone
    required: false

key_value:
    default: null
    description:
    - The C(zfs) module takes key=value pairs for zfs properties to be set. See the zfs(8)
      man page for more information.
    required: false