W3cubDocs

/Ansible 2.11

community.general.zfs – Manage zfs

Note

This plugin is part of the community.general collection (version 2.0.1).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.zfs.

Synopsis

  • Manages ZFS file systems, volumes, clones and snapshots

Parameters

Parameter Choices/Defaults Comments
extra_zfs_properties
string
A dictionary of zfs properties to be set.
See the zfs(8) man page for more information.
name
string / required
File system, snapshot or volume name e.g. rpool/myfs.
origin
string
Snapshot from which to create a clone.
state
string / required
    Choices:
  • absent
  • present
Whether to create (present), or remove (absent) a file system, snapshot or volume. All parents/children will be created/destroyed as needed to reach the desired state.

Examples

- 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

- name: Create a new volume called myvol in pool rpool.
  community.general.zfs:
    name: rpool/myvol
    state: present
    extra_zfs_properties:
      volsize: 10M

- name: Create a snapshot of rpool/myfs file system.
  community.general.zfs:
    name: rpool/myfs@mysnapshot
    state: present

- name: Create a new file system called myfs2 with snapdir enabled
  community.general.zfs:
    name: rpool/myfs2
    state: present
    extra_zfs_properties:
      snapdir: enabled

- name: Create a new file system by cloning a snapshot
  community.general.zfs:
    name: rpool/cloned_fs
    state: present
    origin: rpool/myfs@mysnapshot

- name: Destroy a filesystem
  community.general.zfs:
    name: rpool/myfs
    state: absent

Authors

  • Johan Wiren (@johanwiren)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/general/zfs_module.html