Documentation

zfs_facts - Gather facts about ZFS datasets.

New in version 2.3.

Synopsis

  • Gather facts from ZFS dataset properties.

Parameters

Parameter
Choices/Defaults
Comments
depth
Specifiies recurion depth.
name
required
ZFS dataset name.

aliases: ds, dataset
parsable
    Choices:
  • no ←
  • yes
Specifies if property values should be displayed in machine friendly format.
properties
Default:
all
Specifies which dataset properties should be queried in comma-separated format. For more information about dataset properties, check zfs(1M) man page.

aliases: props
recurse
    Choices:
  • no ←
  • yes
Specifies if properties for any children should be recursively displayed.
type
    Choices:
  • all ←
  • filesystem
  • volume
  • snapshot
  • bookmark
Specifies which datasets types to display. Multiple values have to be provided in comma-separated form.

Examples

- name: Gather facts about ZFS dataset rpool/export/home
  zfs_facts:
    dataset: rpool/export/home

- name: Report space usage on ZFS filesystems under data/home
  zfs_facts:
    name: data/home
    recurse: yes
    type: filesystem

- debug:
    msg: 'ZFS dataset {{ item.name }} consumes {{ item.used }} of disk space.'
  with_items: '{{ ansible_zfs_datasets }}'

Return Values

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

Key
Returned
Description
name
string
always
ZFS dataset name

Sample:
rpool/var/spool
parsable
boolean
if 'parsable' is set to True
if parsable output should be provided in machine friendly format.

Sample:
True
recurse
boolean
if 'recurse' is set to True
if we should recurse over ZFS dataset

Sample:
True
zfs_datasets
string
always
ZFS dataset facts

Sample:
{'setuid': 'on', 'referenced': '29.5K', 'logicalused': '3.45G', 'zoned': 'off', 'primarycache': 'all', 'logbias': 'latency', 'creation': 'Thu Jun 16 11:37 2016', 'sync': 'standard', 'copies': '1', 'sharenfs': 'off', 'usedbyrefreservation': '0', 'sharesmb': 'off', 'canmount': 'on', 'mountpoint': '/rpool', 'casesensitivity': 'sensitive', 'utf8only': 'off', 'usedbysnapshots': '0', 'readonly': 'off', 'mounted': 'yes', 'compression': 'off', 'xattr': 'on', 'aclmode': 'discard', 'dedup': 'off', 'snapshot_limit': 'none', 'aclinherit': 'restricted', 'compressratio': '1.00x', 'written': '29.5K', 'version': '5', 'normalization': 'none', 'filesystem_limit': 'none', 'type': 'filesystem', 'secondarycache': 'all', 'logicalreferenced': '18.5K', 'available': '43.8G', 'used': '4.41G', 'exec': 'on', 'refquota': 'none', 'refcompressratio': '1.00x', 'quota': 'none', 'snapshot_count': 'none', 'vscan': 'off', 'reservation': 'none', 'atime': 'on', 'recordsize': '128K', 'usedbychildren': '4.41G', 'usedbydataset': '29.5K', 'org.openindiana.caiman:install': 'ready', 'name': 'rpool', 'mlslabel': 'none', 'redundant_metadata': 'all', 'filesystem_count': 'none', 'devices': 'on', 'nbmand': 'off', 'refreservation': 'none', 'checksum': 'on', 'snapdir': 'hidden'}


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Adam Števko (@xen0l)

Hint

If you notice any issues in this documentation you can edit this document to improve it.