Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.21
Documentation for other releases can be found by using the version selector in the top right of any doc page.zpool
Manage ZFS storage pools.
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| name | true | string | Pool name. | |
| state | string | info present absent imported exported scrubbed |
Pool state. [default: "info"] |
|
| devices | array | List of devices for pool creation. | ||
| pool_type | string | single mirror raidz raidz2 raidz3 |
Pool type (single, mirror, raidz, raidz2, raidz3). [default: "single"] |
|
| properties | object | Pool properties (ashift, autoexpand, etc.). | ||
| features | object | Feature flags to enable. | ||
| altroot | string | Alternate root mount point. | ||
| mounthost | string | Mount host for pools. | ||
| force | boolean | Force operation. [default: false] |
||
| guid | string | Pool GUID for import by GUID. |
Example
- name: Create mirrored ZFS pool
zpool:
name: rpool
state: present
type: mirror
devices:
- /dev/nvme0n1p3
- /dev/nvme1n1p3
properties:
ashift: 12
autoexpand: on
features:
encryption: enabled
- name: Create single device pool
zpool:
name: datapool
state: present
devices:
- /dev/sda1
- name: Set pool property
zpool:
name: rpool
state: present
properties:
cachefile: none
- name: Export pool
zpool:
name: rpool
state: exported
- name: Import pool by name
zpool:
name: rpool
state: imported
- name: Import pool by GUID
zpool:
guid: 1234567890abcdef
state: imported
name: rpool
- name: Destroy pool
zpool:
name: rpool
state: absent
force: true
- name: Start scrub
zpool:
name: rpool
state: scrubbed
- name: Get pool info
zpool:
name: rpool
state: info