proxmox_lxc
!proxmox_lxc
Category: proxmox
Manage a Proxmox LXC container via the API (create/remove). Self-signed certs accepted. Idempotent on state.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
api_host | string | yes | Proxmox API host (hostname or IP; port 8006 implied). |
api_token_id | string | yes | Proxmox API token ID. |
api_token_secret | string | yes | Proxmox API token secret. |
node | string | yes | Proxmox node name to place the container on. |
vmid | int | yes | Container VMID. |
hostname | string | no | Container hostname. |
ostemplate | string | no | Template storage path (e.g. local:vztmpl/debian-12.tar.zst). |
storage | string | no | Root-disk storage pool. Default local-lvm. |
memory | int | no | Memory in MB. Default 512. |
cores | int | no | CPU core count. Default 1. |
rootfs_size | string | no | Rootfs size string appended to storage. Default 8G. |
net0 | string | no | Raw Proxmox net0 config string. |
password | string | no | Root password. |
unprivileged | bool | no | Unprivileged container. Default true. |
start_on_create | bool | no | Start container immediately after creation. |
state | string | no | present (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