damex.incus.incus_storage module – Ensure Incus storage

Note

This module is part of the damex.incus collection (version 1.11.7).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install damex.incus.

To use it in a playbook, specify: damex.incus.incus_storage.

Synopsis

  • Create, update, and delete Incus storage pools via the Incus REST API.

  • Storage pools are global resources, not project-scoped.

  • The storage driver is set on creation and cannot be changed afterwards.

Parameters

Parameter

Comments

client_cert

string

Client certificate content for remote authentication.

Requires url and client_key. Mutually exclusive with token and client_cert_path.

client_cert_path

string

Client certificate path for remote authentication.

Requires url and client_key_path. Mutually exclusive with token and client_cert.

client_key

string

Client key content for remote authentication.

Requires url and client_cert. Mutually exclusive with client_key_path.

client_key_path

string

Client key path for remote authentication.

Requires url and client_cert_path. Mutually exclusive with client_key.

config

dictionary

Storage pool configuration key-value pairs.

Boolean values are converted to lowercase strings.

Default: {}

btrfs.mount_options

string

Mount options for the Btrfs filesystem.

ceph.cluster_name

string

Name of the Ceph cluster.

ceph.osd.data_pool_name

string

Name of the Ceph OSD data pool.

ceph.osd.pg_name

string

Name of the Ceph OSD placement group.

ceph.osd.pool_name

string

Name of the Ceph OSD pool.

ceph.rbd.clone_copy

boolean

Whether to use RBD lightweight clones.

Choices:

  • false

  • true

ceph.rbd.du

boolean

Whether to use RBD disk usage tracking.

Choices:

  • false

  • true

ceph.rbd.features

string

RBD image features to enable.

ceph.user.name

string

Ceph user name.

cephfs.cluster_name

string

Name of the CephFS cluster.

cephfs.create_missing

boolean

Create missing CephFS pools.

Choices:

  • false

  • true

cephfs.data_pool

string

Name of the CephFS data pool.

cephfs.fscache

boolean

Whether to enable fscache for CephFS.

Choices:

  • false

  • true

cephfs.meta_pool

string

Name of the CephFS metadata pool.

cephfs.osd_pg_num

string

Number of placement groups for CephFS OSD pools.

cephfs.path

string

CephFS path to mount.

cephfs.user.name

string

CephFS user name.

cephobject.bucket_name_prefix

string

Prefix for Ceph object store bucket names.

cephobject.cluster_name

string

Name of the Ceph object store cluster.

cephobject.radosgw.endpoint

string

URL of the RADOS Gateway endpoint.

cephobject.radosgw.endpoint_cert_file

string

Path to the RADOS Gateway endpoint certificate.

cephobject.user.name

string

Ceph object store user name.

drbd.auto_add_quorum_tiebreaker

boolean

Whether to automatically add a DRBD quorum tiebreaker.

Choices:

  • false

  • true

drbd.auto_diskful

string

Automatic diskful mode for DRBD.

drbd.on_no_quorum

string

Action to take when DRBD has no quorum.

linstor.resource_group.name

string

Name of the LINSTOR resource group.

linstor.resource_group.place_count

integer

Number of replicas in the LINSTOR resource group.

linstor.resource_group.storage_pool

string

LINSTOR storage pool for the resource group.

linstor.volume.prefix

string

Prefix for LINSTOR volume names.

lvm.metadata_size

string

Size of the LVM metadata volume.

lvm.thinpool_metadata_size

string

Size of the LVM thin pool metadata volume.

lvm.thinpool_name

string

Name of the LVM thin pool.

lvm.use_thinpool

boolean

Whether to use an LVM thin pool.

Choices:

  • false

  • true

lvm.vg.force_reuse

boolean

Force reuse of an existing LVM volume group.

Choices:

  • false

  • true

lvm.vg_name

string

Name of the LVM volume group.

rsync.bwlimit

string

Upper limit on the bandwidth for rsync.

rsync.compression

boolean

Whether to use compression for rsync.

Choices:

  • false

  • true

size

string

Size of the storage pool.

source

string

Path or device to use as storage source.

source.wipe

boolean

Wipe the source device before use.

Choices:

  • false

  • true

truenas.allow_insecure

boolean

Allow insecure connections to TrueNAS.

Choices:

  • false

  • true

truenas.api_key

string

API key for TrueNAS authentication.

truenas.clone_copy

boolean

Whether to use TrueNAS lightweight clones.

Choices:

  • false

  • true

truenas.config

string

Path to the TrueNAS configuration file.

truenas.dataset

string

Name of the TrueNAS dataset.

truenas.force_reuse

boolean

Force reuse of an existing TrueNAS dataset.

Choices:

  • false

  • true

truenas.host

string

Hostname or IP of the TrueNAS server.

truenas.initiator

string

iSCSI initiator name for TrueNAS.

truenas.portal

string

iSCSI portal ID for TrueNAS.

zfs.blocksize

string

Block size for the ZFS pool.

zfs.clone_copy

boolean

Whether to use ZFS lightweight clones.

Choices:

  • false

  • true

zfs.export

boolean

Whether to export the ZFS pool on removal.

Choices:

  • false

  • true

zfs.pool_name

string

Name of the ZFS pool.

description

string

Storage pool description.

Default: ""

driver

string

Storage driver.

Required when creating a new storage pool.

Ignored on update — driver cannot be changed after creation.

Choices:

  • "dir"

  • "btrfs"

  • "lvm"

  • "zfs"

  • "ceph"

  • "cephfs"

  • "cephobject"

  • "linstor"

  • "truenas"

name

string / required

Name of the storage pool.

server_cert

string

Server certificate content for remote verification.

Requires url. Mutually exclusive with server_cert_path.

server_cert_path

string

Server certificate path for remote verification.

Requires url. Mutually exclusive with server_cert.

socket_path

string

Incus Unix socket path for local connections.

Default: "/var/lib/incus/unix.socket"

state

string

Desired state of the storage pool.

Choices:

  • "present" ← (default)

  • "absent"

target

string

Cluster member to target for pending storage pool creation.

token

string

Token for remote authentication.

Requires url. Mutually exclusive with client_cert.

url

string

Remote Incus server URL (e.g. https://host:8443).

If specified, connects via HTTPS instead of Unix socket.

validate_certs

boolean

Server TLS certificate validation.

Choices:

  • false

  • true ← (default)

wait

boolean

Async operation completion wait.

Set to false for fire-and-forget behaviour.

Choices:

  • false

  • true ← (default)

Examples

- name: Ensure dir storage pool
  damex.incus.incus_storage:
    name: default
    driver: dir

- name: Ensure ZFS storage pool
  damex.incus.incus_storage:
    name: tank
    driver: zfs
    config:
      zfs.pool_name: tank

- name: Ensure storage pool on cluster member
  damex.incus.incus_storage:
    name: pool1
    driver: dir
    target: node1

- name: Ensure storage pool is finalized
  damex.incus.incus_storage:
    name: pool1
    driver: dir

- name: Ensure storage pool is absent
  damex.incus.incus_storage:
    name: default
    state: absent

Return Values

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

Key

Description

changed

boolean

Resource state change indicator.

Returned: always

changed_keys

list / elements=string

Configuration keys that changed.

Returned: always

diff

dictionary

Before and after state for diff mode.

Returned: changed

after

dictionary

State after the change.

Returned: success

before

dictionary

State before the change.

Returned: success

Authors

  • Roman Kuzmitskii (@damex)