community.proxmox.proxmox_snap module – Snapshot management of instances in Proxmox VE cluster
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_snap.
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 >= 2.0 
- requests 
Parameters
| Parameter | Comments | 
|---|---|
| Specify the target host of the Proxmox VE cluster. Uses the  | |
| Specify the password to authenticate with. Uses the  | |
| Specify the target port of the Proxmox VE cluster. Uses the  | |
| Specify the token ID. Uses the  | |
| Specify the token secret. Uses the  | |
| Specify the user to authenticate with. Uses the  | |
| Specify the description for the snapshot. Only used on the configuration web interface. This is saved as a comment inside the configuration file. | |
| For removal from config file, even if removing disk snapshot fails. Choices: 
 | |
| The instance name. | |
| Remove old snapshots if there are more than  If  This is only used when  Default:  | |
| Name of the snapshot that has to be created/deleted/restored. Default:  | |
| Indicate desired state of the instance snapshot. Choices: 
 | |
| Timeout for operations. Default:  | |
| This option only applies to LXC containers. Allows to snapshot a container even if it has configured mountpoints. Temporarily disables all configured mountpoints, takes snapshot, and finally restores original configuration. If running, the container will be stopped and restarted to apply config changes. Due to restrictions in the Proxmox API this option can only be used authenticating as  See https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc/{vmid}/config (PUT tab) for more details. Choices: 
 | |
| If  This should only be used on personally controlled sites using self-signed certificates. Uses the  Choices: 
 | |
| The instance ID. If not set, will be fetched from PromoxAPI based on the hostname. | |
| Snapshot includes RAM. Choices: 
 | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| Action group: community.proxmox.proxmox | Use  | |
| Support: full | Can run in  | |
| Support: none | Will return details on what has changed (or possibly needs changing in  | 
Notes
Note
- Requires proxmoxer and requests modules on host. These modules can be installed with pip. 
Examples
- name: Create new container snapshot
  community.proxmox.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: present
    snapname: pre-updates
- name: Create new container snapshot and keep only the 2 newest snapshots
  community.proxmox.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: present
    snapname: snapshot-42
    retention: 2
- name: Create new snapshot for a container with configured mountpoints
  community.proxmox.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: present
    unbind: true # requires root@pam+password auth, API tokens are not supported
    snapname: pre-updates
- name: Remove container snapshot
  community.proxmox.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: absent
    snapname: pre-updates
- name: Rollback container snapshot
  community.proxmox.proxmox_snap:
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    vmid: 100
    state: rollback
    snapname: pre-updates
