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 |
|---|---|
api_host string / required | Specify the target host of the Proxmox VE cluster. Uses the |
api_password string | Specify the password to authenticate with. Uses the |
api_port integer | Specify the target port of the Proxmox VE cluster. Uses the |
api_token_id string | Specify the token ID. Uses the |
api_token_secret string | Specify the token secret. Uses the |
api_user string / required | Specify the user to authenticate with. Uses the |
checksum string | 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, |
checksum_algorithm string | Algorithm used to verify the checksum. If specified, Choices:
|
content_type string | |
force boolean | It can only be used with Choices:
|
node string | Proxmox VE node on which to operate. |
src path | Path to uploaded file. Exactly one of |
state string | Indicate desired state of the template. Choices:
|
storage string | Target storage. Default: |
template string | The template name. Required for Required for |
timeout integer | Timeout for operations. Default: |
url string | URL to file to download. Exactly one of |
validate_certs boolean | If This should only be used on personally controlled sites using self-signed certificates. Uses the Choices:
|
Attributes
Attribute | Support | Description |
|---|---|---|
action_group | Action group: community.proxmox.proxmox | Use |
check_mode | Support: none | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Notes
Note
- Requires
proxmoxerandrequestsmodules 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
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/proxmox/proxmox_template_module.html