community.general.proxmox_snap module – Snapshot management of instances in Proxmox VE cluster

Note

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

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.proxmox_snap.

New in version 2.0.0: of community.general

Synopsis

  • Allows you to create/delete/restore snapshots from instances in Proxmox VE cluster.

  • Supports both KVM and LXC, OpenVZ has not been tested, as it is no longer supported on Proxmox VE.

Requirements

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

  • proxmoxer

  • python >= 2.7

  • requests

Parameters

Parameter

Comments

api_host

string / required

Specify the target host of the Proxmox VE cluster.

api_password

string

Specify the password to authenticate with.

You can use PROXMOX_PASSWORD environment variable.

api_token_id

string

added in 1.3.0 of community.general

Specify the token ID.

api_token_secret

string

added in 1.3.0 of community.general

Specify the token secret.

api_user

string / required

Specify the user to authenticate with.

description

string

Specify the description for the snapshot. Only used on the configuration web interface.

This is saved as a comment inside the configuration file.

force

boolean

For removal from config file, even if removing disk snapshot fails.

Choices:

  • no ← (default)

  • yes

hostname

string

The instance name.

snapname

string

Name of the snapshot that has to be created/deleted/restored.

Default: “ansible_snap”

state

string

Indicate desired state of the instance snapshot.

The rollback value was added in community.general 4.8.0.

Choices:

  • present ← (default)

  • absent

  • rollback

timeout

integer

Timeout for operations.

Default: 30

validate_certs

boolean

If no, SSL certificates will not be validated.

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

Choices:

  • no ← (default)

  • yes

vmid

string

The instance id.

If not set, will be fetched from PromoxAPI based on the hostname.

vmstate

boolean

Snapshot includes RAM.

Choices:

  • no ← (default)

  • yes

Notes

Note

  • Requires proxmoxer and requests modules on host. These modules can be installed with pip.

  • Supports check_mode.

Examples

- name: Create new container snapshot
  community.general.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: present
    snapname: pre-updates

- name: Remove container snapshot
  community.general.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: absent
    snapname: pre-updates

- name: Rollback container snapshot
  community.general.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: rollback
    snapname: pre-updates

Authors

  • Jeffrey van Pelt (@Thulium-Drake)