Skip to content

proxmox_lxc

!proxmox_lxc

Category: proxmox

Manage a Proxmox LXC container via the API (create/remove). Self-signed certs accepted. Idempotent on state.

Parameters

NameTypeRequiredDescription
api_hoststringyesProxmox API host (hostname or IP; port 8006 implied).
api_token_idstringyesProxmox API token ID.
api_token_secretstringyesProxmox API token secret.
nodestringyesProxmox node name to place the container on.
vmidintyesContainer VMID.
hostnamestringnoContainer hostname.
ostemplatestringnoTemplate storage path (e.g. local:vztmpl/debian-12.tar.zst).
storagestringnoRoot-disk storage pool. Default local-lvm.
memoryintnoMemory in MB. Default 512.
coresintnoCPU core count. Default 1.
rootfs_sizestringnoRootfs size string appended to storage. Default 8G.
net0stringnoRaw Proxmox net0 config string.
passwordstringnoRoot password.
unprivilegedboolnoUnprivileged container. Default true.
start_on_createboolnoStart container immediately after creation.
statestringnopresent (create if missing, default) or absent (stop + delete).

Examples

- !proxmox_lxc
  api_host: '{{ proxmox_host }}'
  api_token_id: '{{ proxmox_token_id }}'
  api_token_secret: '{{ proxmox_token_secret }}'
  node: bee
  vmid: 201
  hostname: app01
  ostemplate: local:vztmpl/debian-12-standard.tar.zst
  memory: 2048
  cores: 2
  start_on_create: true
  state: present