community.general.lxd_storage_pool_info module – Retrieve information about LXD storage pools

Note

This module is part of the community.general collection (version 12.2.0).

You might already have this collection installed if you are using the ansible package. 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 community.general.

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

New in community.general 12.1.0

Synopsis

  • Retrieve information about LXD storage pools.

  • This module returns details about all storage pools or a specific storage pool.

Parameters

Parameter

Comments

client_cert

aliases: cert_file

path

The client certificate file path.

If not specified, it defaults to $HOME/.config/lxc/client.crt.

client_key

aliases: key_file

path

The client certificate key file path.

If not specified, it defaults to $HOME/.config/lxc/client.key.

name

string

Name of a specific storage pool to retrieve information about.

If not specified, information about all storage pools are returned.

project

string

snap_url

string

The Unix domain socket path when LXD is installed by snap package manager.

Default: "unix:/var/snap/lxd/common/lxd/unix.socket"

trust_password

string

The client trusted password.

You need to set this password on the LXD server before running this module using the following command: lxc config set core.trust_password <some random password> See https://www.stgraber.org/2016/04/18/lxd-api-direct-interaction/.

If trust_password is set, this module sends a request for authentication before sending any requests.

type

list / elements=string

Filter storage pools by driver/type (for example dir, zfs, btrfs, lvm, or ceph).

If not specified, all storage pool types are returned.

Can be a single type or a list of types.

Default: []

url

string

The Unix domain socket path or the https URL for the LXD server.

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

Attributes

Attribute

Support

Description

check_mode

Support: full

This action does not modify state.

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

This action does not modify state.

Returns details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Examples

- name: Get information about all storage pools
  community.general.lxd_storage_pool_info:
  register: result

- name: Get information about a specific storage pool
  community.general.lxd_storage_pool_info:
    name: default
  register: result

- name: Get information about all ZFS storage pools
  community.general.lxd_storage_pool_info:
    type:
      - zfs
      - ceph
  register: result

- name: Get information about ZFS and BTRFS storage pools
  community.general.lxd_storage_pool_info:
    type:
      - zfs
      - btrfs
  register: result

- name: Get storage pool information via HTTPS connection
  community.general.lxd_storage_pool_info:
    url: https://127.0.0.1:8443
    trust_password: mypassword
    name: default
  register: result

- name: Get storage pool information for a specific project
  community.general.lxd_storage_pool_info:
    project: myproject
  register: result

Return Values

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

Key

Description

logs

list / elements=dictionary

The logs of requests and responses.

Returned: when ansible-playbook is invoked with -vvvv.

Sample: [{"request": {"json": null, "method": "GET", "timeout": null, "url": "/1.0/storage-pools"}, "response": {"json": {"status": "Success", "type": "sync"}}, "type": "sent request"}]

storage_pools

list / elements=dictionary

List of LXD storage pools.

Returned: success

Sample: [{"config": {"source": "/var/lib/lxd/storage-pools/default"}, "description": "Default storage pool", "driver": "dir", "locations": ["none"], "name": "default", "status": "Created", "used_by": ["/1.0/instances/container1"]}]

config

dictionary

Configuration of the storage pool.

Returned: success

description

string

Description of the storage pool.

Returned: success

driver

string

The storage pool driver/type.

Returned: success

locations

list / elements=string

Cluster member locations for the pool.

Returned: success

name

string

The name of the storage pool.

Returned: success

status

string

Current status of the storage pool.

Returned: success

used_by

list / elements=string

List of resources using this storage pool.

Returned: success

Authors

  • Sean McAvoy (@smcavoy)