arensb.truenas.filesystem module – Manage ZFS datasets (filesystems/volumes) via TrueNAS middleware
Note
This module is part of the arensb.truenas collection (version 1.11.4).
To install it, use: ansible-galaxy collection install arensb.truenas
.
To use it in a playbook, specify: arensb.truenas.filesystem
.
Synopsis
Create, update, and delete ZFS datasets on TrueNAS using the middleware API.
Prevents sending null or invalid fields that cause errors.
Normalizes property values so that e.g. ‘64K’ is treated the same as ‘65536’ for volblocksize comparisons. If a user tries to change volblocksize or sparse on an existing volume, the module raises an error (since TrueNAS disallows it).
Parameters
Parameter |
Comments |
---|---|
Arbitrary comment or notes for the dataset. |
|
If True, create any missing parent datasets automatically when creating. Under TrueNAS CORE, this option is ignored. However, missing ancestors are not created. Choices:
|
|
Whether to ignore checks if the volume size is below thresholds. Only valid for type=VOLUME. Choices:
|
|
Full name (ZFS path) of the dataset, e.g. “pool/dataset”. |
|
Whether to create a sparse volume (if type=VOLUME). Cannot be changed after creation. Choices:
|
|
If “present”, ensure the dataset is created/updated. If “absent”, ensure the dataset is deleted. Choices:
|
|
Dataset type: FILESYSTEM or VOLUME. Choices:
|
|
Volume block size if type=VOLUME, e.g. “64K” or “65536”. Only valid at dataset creation time; cannot be changed on an existing volume. Choices:
|
|
Size of the volume if type=VOLUME. This can be either an integer, or a string like ‘640K’, ‘32MB’, ‘10GiB’, or ‘1TB’.
This is required when creating a volume, but not when updating an existing one. |
Examples
- name: Delete dataset if it exists
filesystem:
name: test-expansion/chunkr3
state: absent
- name: Create volume with 'sparse' = true
filesystem:
name: test-expansion/test-iscsi
type: VOLUME
volsize: 655360
volblocksize: "64K"
sparse: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Dataset properties as returned by the TrueNAS middleware. Returned: on success |