maxhoesel.proxmox.lxc_container_to_ostemplate role – Converts a LXC container into an ostemplate that can be used to generate new containers
Note
This role is part of the maxhoesel.proxmox collection (version 5.1.1).
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 maxhoesel.proxmox.
To use it in a playbook, specify: maxhoesel.proxmox.lxc_container_to_ostemplate.
Entry point main – Converts a LXC container into an ostemplate that can be used to generate new containers
Synopsis
This role performs the following actions: 1. Creates a gz-compressed backup of a given container with vzdump 2. Moves the backup into the templates location of a given storage volume
To execute this role, Ansible needs to access the Proxmox host on which the container will be created. To speficy the host, set
pve_hostto the hots’ inventory name. If you don’t want to add the host to your inventory file, you can also add it at runtime with theadd_hostmodule - see the role README for an example.The main use for this role is to create an Ansible-compatible container image by consuming images created with the
lxc_containerrole. If you are looking for a more general solution to deploy LXC containers, I recommend looking into the community.general.proxmox module (that also powers this role) or, for a more Infrastructure-as-Code oriented approach, Terraform.
Parameters
Parameter |
Comments |
|---|---|
Hostname of the container to convert into an image lxcostemplate_vmid overwrites this parameter |
|
Name of the ostemplate image to generate. .tar.gz will be appended automatically |
|
Set to yes if you want to overwrite an already existing image Choices:
|
|
Name of the storage volume under which the ostemplate will be saved Default: |
|
VMID of the container to convert into an image Takes precedence over lxcostemplate_hostname |
|
Select the type of vzdump backup to perform. Options are stop, suspend and snapshot Choices:
|
|
Inventory hostname of the PVE host to create the container on. Ansible will connect to this host. |