community.proxmox.proxmox_template module – Management of OS templates 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_template.
Synopsis
- Allows you to upload/delete templates in Proxmox VE cluster. 
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  | |
| The checksum to validate against. Checksums are often provided by software distributors to verify that a download is not corrupted. Checksums can usually be found on the distributors download page in the form of a file or string. If specified,  | |
| Algorithm used to verify the checksum. If specified,  Choices: 
 | |
| It can only be used with  Choices: 
 | |
| Proxmox VE node on which to operate. | |
| Path to uploaded file. Exactly one of  | |
| Indicate desired state of the template. Choices: 
 | |
| Target storage. Default:  | |
| The template name. Required for  Required for  | |
| Timeout for operations. Default:  | |
| URL to file to download. Exactly one of  | |
| If  This should only be used on personally controlled sites using self-signed certificates. Uses the  Choices: 
 | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| Action group: community.proxmox.proxmox | Use  | |
| Support: none | Can run in  | |
| Support: none | Will return details on what has changed (or possibly needs changing in  | 
Notes
Note
- Requires - proxmoxerand- requestsmodules on host. Those modules can be installed with ansible.builtin.pip.
- Requires - requests_toolbeltto upload files larger than 256 MB.
Examples
---
- name: Upload new openvz template with minimal options
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    src: ~/ubuntu-14.04-x86_64.tar.gz
- name: Pull new openvz template with minimal options
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    url: https://ubuntu-mirror/ubuntu-14.04-x86_64.tar.gz
- name: >
    Upload new openvz template with minimal options use environment
    PROXMOX_PASSWORD variable(you should export it before)
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_host: node1
    src: ~/ubuntu-14.04-x86_64.tar.gz
- name: Upload new openvz template with all options and force overwrite
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    storage: local
    content_type: vztmpl
    src: ~/ubuntu-14.04-x86_64.tar.gz
    force: true
- name: Pull new openvz template with all options and force overwrite
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    storage: local
    content_type: vztmpl
    url: https://ubuntu-mirror/ubuntu-14.04-x86_64.tar.gz
    force: true
- name: Delete template with minimal options
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    template: ubuntu-14.04-x86_64.tar.gz
    state: absent
- name: Download proxmox appliance container template
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    storage: local
    content_type: vztmpl
    template: ubuntu-20.04-standard_20.04-1_amd64.tar.gz
- name: Download and verify a template's checksum
  community.proxmox.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    url: ubuntu-20.04-standard_20.04-1_amd64.tar.gz
    checksum_algorithm: sha256
    checksum: 65d860160bdc9b98abf72407e14ca40b609417de7939897d3b58d55787aaef69
