community.general.zpool_facts – Gather facts about ZFS pools.

Note

This plugin is part of the community.general collection.

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

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

Synopsis

  • Gather facts from ZFS pool properties.

Parameters

Parameter Choices/Defaults Comments
name
string
ZFS pool name.

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

aliases: props

Examples

- name: Gather facts about ZFS pool rpool
  community.general.zpool_facts: pool=rpool

- name: Gather space usage about all imported ZFS pools
  community.general.zpool_facts: properties='free,size'

- 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 }}'

Returned Facts

Facts returned by this module are added/updated in the hostvars host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.

Fact Returned Description
ansible_zfs_pools
string / elements=string
always
ZFS pool facts

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', '[email protected]_destroy': 'enabled', '[email protected]': 'enabled', '[email protected]': 'enabled', '[email protected]_data': 'active', '[email protected]_bpobj': 'active', '[email protected]_txg': 'active', '[email protected]_dataset': 'enabled', '[email protected]_limits': 'enabled', '[email protected]_birth': 'active', '[email protected]_blocks': 'enabled', '[email protected]_compress': 'active', '[email protected]_vdev_crash_dump': 'enabled', '[email protected]': 'enabled', '[email protected]': 'enabled', '[email protected]_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': '-'}


Return Values

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

Key Returned Description
name
string
always
ZFS pool name

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

Sample:
True


Authors

  • Adam Števko (@xen0l)