community.general.zpool_facts (8.5.0) — module

Gather facts about ZFS pools

Authors: Adam Števko (@xen0l)

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

Gather facts from ZFS pool properties.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather facts about ZFS pool rpool
  community.general.zpool_facts: pool=rpool
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather space usage about all imported ZFS pools
  community.general.zpool_facts: properties='free,size'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print gathered information
  ansible.builtin.debug:
    msg: 'ZFS pool {{ item.name }} has {{ item.free }} free space out of {{ item.size }}.'
  with_items: '{{ ansible_zfs_pools }}'

Inputs

    
name:
    aliases:
    - pool
    - zpool
    description:
    - ZFS pool name.
    required: false
    type: str

parsable:
    default: false
    description:
    - Specifies if property values should be displayed in machine friendly format.
    required: false
    type: bool

properties:
    default: all
    description:
    - Specifies which dataset properties should be queried in comma-separated format.
      For more information about dataset properties, check zpool(1M) man page.
    required: false
    type: str

Outputs

ansible_facts:
  contains:
    ansible_zfs_pools:
      description: ZFS pool facts
      returned: always
      sample:
        allocated: 3.46G
        altroot: '-'
        autoexpand: 'off'
        autoreplace: 'off'
        bootfs: rpool/ROOT/openindiana
        cachefile: '-'
        capacity: 6%
        comment: '-'
        dedupditto: '0'
        dedupratio: 1.00x
        delegation: 'on'
        expandsize: '-'
        failmode: wait
        feature@async_destroy: enabled
        feature@bookmarks: enabled
        feature@edonr: enabled
        feature@embedded_data: active
        feature@empty_bpobj: active
        feature@enabled_txg: active
        feature@extensible_dataset: enabled
        feature@filesystem_limits: enabled
        feature@hole_birth: active
        feature@large_blocks: enabled
        feature@lz4_compress: active
        feature@multi_vdev_crash_dump: enabled
        feature@sha512: enabled
        feature@skein: enabled
        feature@spacemap_histogram: active
        fragmentation: 3%
        free: 46.3G
        freeing: '0'
        guid: '15729052870819522408'
        health: ONLINE
        leaked: '0'
        listsnapshots: 'off'
        name: rpool
        readonly: 'off'
        size: 49.8G
        version: '-'
      type: str
  description: Dictionary containing all the detailed information about the ZFS pool
    facts
  returned: always
  type: complex
name:
  description: ZFS pool name
  returned: always
  sample: rpool
  type: str
parsable:
  description: if parsable output should be provided in machine friendly format.
  returned: if 'parsable' is set to True
  sample: true
  type: bool