community.proxmox.proxmox_storage module – Manage storage in PVE clusters and nodes

Note

This module is part of the community.proxmox collection (version 1.3.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.proxmox. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.proxmox.proxmox_storage.

New in community.proxmox 1.3.0

Synopsis

  • Manage storage in PVE clusters and nodes.

Requirements

The below requirements are needed on the host that executes this module.

  • proxmoxer >= 2.0

  • requests

Parameters

Parameter

Comments

api_host

string / required

Specify the target host of the Proxmox VE cluster.

Uses the PROXMOX_HOST environment variable if not specified.

api_password

string

Specify the password to authenticate with.

Uses the PROXMOX_PASSWORD environment variable if not specified.

api_port

integer

Specify the target port of the Proxmox VE cluster.

Uses the PROXMOX_PORT environment variable if not specified.

api_token_id

string

Specify the token ID.

Uses the PROXMOX_TOKEN_ID environment variable if not specified.

api_token_secret

string

Specify the token secret.

Uses the PROXMOX_TOKEN_SECRET environment variable if not specified.

api_user

string / required

Specify the user to authenticate with.

Uses the PROXMOX_USER environment variable if not specified.

cephfs_options

dictionary

Extended information for adding CephFS storage.

client_keyring

string

The client keyring to be used.

fs_name

string

The Ceph filesystem name

monhost

list / elements=string

The hostname or IP address of the monhost.

password

string

The required password for the storage system.

path

string

The path to be used within the CephFS.

Default: "/"

subdir

string

The subdir to be used within the CephFS.

username

string

The required username for the storage system.

cifs_options

dictionary

Extended information for adding CIFS storage.

domain

string

The required domain for the CIFS share.

password

string

The required password for the storage system.

server

string

The hostname or IP address of the remote storage system.

share

string

The share to be used from the remote storage system.

smb_version

string

The minimum SMB version to use for.

username

string

The required username for the storage system.

content

list / elements=string

The desired content that should be used with this storage type.

Required when state=present.

Choices:

  • "images"

  • "snippets"

  • "import"

  • "iso"

  • "backup"

  • "rootdir"

  • "vztmpl"

iscsi_options

dictionary

Extended information for adding iSCSI storage.

portal

string

The hostname or IP address of the remote storage system as the portal address.

target

string

The required iSCSI target.

name

string / required

The name of the storage displayed in the storage list.

nfs_options

dictionary

Extended information for adding NFS storage.

export

string

The required NFS export path.

options

string

Additional NFS related mount options (e.g., version, pNFS).

server

string

The hostname or IP address of the remote storage system.

nodes

list / elements=string

A list of Proxmox VE nodes on which the target storage is enabled.

Required when state=present.

pbs_options

dictionary

Extended information for adding Proxmox Backup Server as storage.

datastore

string

The required datastore to use from the Proxmox Backup Server.

fingerprint

string

The required fingerprint of the Proxmox Backup Server system.

password

string

The required password for the Proxmox Backup Server.

server

string

The hostname or IP address of the Proxmox Backup Server.

username

string

The required username for the Proxmox Backup Server.

state

string

The state of the defined storage type to perform.

Choices:

  • "present"

  • "absent"

type

string / required

The storage type/protocol to use when adding the storage.

Choices:

  • "cephfs"

  • "cifs"

  • "iscsi"

  • "nfs"

  • "pbs"

validate_certs

boolean

If false, SSL certificates will not be validated.

This should only be used on personally controlled sites using self-signed certificates.

Uses the PROXMOX_VALIDATE_CERTS environment variable if not specified.

Choices:

  • false ← (default)

  • true

Attributes

Attribute

Support

Description

action_group

Action group: community.proxmox.proxmox

Use group/community.proxmox.proxmox in module_defaults to set defaults for this module.

check_mode

Support: full

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

diff_mode

Support: none

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

Examples

- name: Add PBS storage to Proxmox VE Cluster
  community.proxmox.proxmox_storage:
    api_host: proxmoxhost
    api_user: root@pam
    api_password: password123
    validate_certs: false
    nodes: ["de-cgn01-virt01", "de-cgn01-virt02"]
    state: present
    name: backup-backupserver01
    type: pbs
    pbs_options:
      server: proxmox-backup-server.example.com
      username: backup@pbs
      password: password123
      datastore: backup
      fingerprint: "F3:04:D2:C1:33:B7:35:B9:88:D8:7A:24:85:21:DC:75:EE:7C:A5:2A:55:2D:99:38:6B:48:5E:CA:0D:E3:FE:66"
      export: "/mnt/storage01/b01pbs01"
    content: ["backup"]
- name: Add NFS storage to Proxmox VE Cluster
  community.proxmox.proxmox_storage:
    api_host: proxmoxhost
    api_user: root@pam
    api_password: password123
    validate_certs: false
    nodes: ["de-cgn01-virt01", "de-cgn01-virt02"]
    state: present
    name: net-nfsshare01
    type: nfs
    nfs_options:
      server: 10.10.10.94
      export: "/mnt/storage01/s01nfs01"
    content: ["rootdir", "images"]
- name: Add iSCSI storage to Proxmox VE Cluster
  community.proxmox.proxmox_storage:
    api_host: proxmoxhost
    api_user: root@pam
    api_password: password123
    validate_certs: false
    nodes: ["de-cgn01-virt01", "de-cgn01-virt02", "de-cgn01-virt03"]
    state: present
    type: iscsi
    name: net-iscsi01
    iscsi_options:
      portal: 10.10.10.94
      target: "iqn.2005-10.org.freenas.ctl:s01-isci01"
    content: ["rootdir", "images"]
- name: Remove storage from Proxmox VE Cluster
  community.proxmox.proxmox_storage:
    api_host: proxmoxhost
    api_user: root@pam
    api_password: password123
    validate_certs: false
    state: absent
    name: net-nfsshare01
    type: nfs

Return Values

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

Key

Description

storage

string

Status message about the storage action.

Returned: success

Sample: "Storage 'net-nfsshare01' created successfully."

Authors

  • Florian Paul Azim Hoberg (@gyptazy)