W3cubDocs

/Ansible

community.general.proxmox_template – management of OS templates in Proxmox VE cluster

Note

This plugin is part of the community.general collection (version 3.8.1).

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_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
  • requests

Parameters

Parameter Choices/Defaults 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.
content_type
string
    Choices:
  • vztmpl
  • iso
content type
required only for state=present
force
boolean
    Choices:
  • no
  • yes
can be used only with state=present, exists template will be overwritten
node
string
Proxmox VE node on which to operate.
src
path
path to uploaded file
required only for state=present
state
string
    Choices:
  • present
  • absent
Indicate desired state of the template
storage
string
Default:
"local"
target storage
template
string
the template name
Required for state absent to delete a template.
Required for state present to download an appliance container template (pveam).
timeout
integer
Default:
30
timeout for operations
validate_certs
boolean
    Choices:
  • no
  • yes
If no, SSL certificates will not be validated.
This should only be used on personally controlled sites using self-signed certificates.

Notes

Note

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

Examples

- name: Upload new openvz template with minimal options
  community.general.proxmox_template:
    node: uk-mc02
    api_user: root@pam
    api_password: 1q2w3e
    api_host: node1
    src: ~/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.general.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.general.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: yes

- name: Delete template with minimal options
  community.general.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.general.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

Authors

  • Sergei Antipov (@UnderGreen)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/proxmox_template_module.html