# pve_lxc Creates and maintains a Proxmox VE LXC container through the Proxmox API: configuration, root disk size, raw `lxc.*` config lines, an opt-in guest firewall file and the power state. Variables and their types are defined in [`meta/argument_specs.yml`](meta/argument_specs.yml), which is the source of truth. ## Supported platforms Proxmox VE nodes on Debian 13 (trixie). The play runs for the container's inventory host: the API calls run on the controller (`delegate_to: localhost`), and the raw config, the guest firewall file and the filesystem resize run on the Proxmox node (`delegate_to: pve_lxc_node`) with become. Untested platforms: Debian trixie, as declared in `meta/main.yml`. The molecule scenario runs the node-side tasks in an Ubuntu 24.04 (noble) container standing in for the node (see [Tests](#tests)); a Debian test image does not exist yet. The role targets Proxmox nodes only, so it does not cover Ubuntu noble or resolute: Proxmox VE runs on Debian. ## Requirements and run order - Use it by its fully qualified name, `mortis.kamino.pve_lxc`, in a play over the container hosts. It gathers no facts and needs none. - The controller needs the `community.proxmox` collection and the Python library `proxmoxer`. - Role dependencies: none. - `pve_lxc_node` must be an inventory host: the node-side tasks are delegated to it, and its `ansible_host` is the default API address. `pve_lxc_api_user` and `pve_lxc_api_token_secret` have no usable default and are asserted non-empty before any change when `pve_lxc_manage_lifecycle` is true; `pve_lxc_net_prefix` too, unless `pve_lxc_state` is `absent`. The raw config and firewall inputs are validated at the same point. - The container's own `ansible_host` is its address in `net0` and the target of the SSH wait, and `inventory_hostname` is its hostname. - Run it before any role that configures the inside of the container. Gate those on `pve_lxc_present` (below), so a container that is absent is not configured. ## Role variables No variable is marked required in the argument spec: with `pve_lxc_manage_lifecycle: false` the role reads none of the Proxmox inputs. | Variable | Default | Description | |---|---|---| | `pve_lxc_state` | `present` | `present`, `started`, `stopped` or `absent`. `present` leaves the power state alone. | | `pve_lxc_manage_lifecycle` | `true` | False skips everything and treats the container as present (a container on a node Ansible does not manage). | | `pve_lxc_allow_destroy` | `false` | Required before `absent` deletes the container. | | `pve_lxc_wait_for_ssh` | `true` | Wait for SSH on port 22 of `ansible_host` when `started`. | | `pve_lxc_manage_disk` | `false` | Grow the root disk to the size in `pve_lxc_disk`. | | `pve_lxc_reboot_if_required` | `true` | Restart the container after its root filesystem was grown. | | `pve_lxc_pubkey` | `""` | Public keys for root, one per line. | | `pve_lxc_features` | `[]` | Container features, for example `nesting=1`. Omitted when empty. | | `pve_lxc_restart_on_config_change` | `false` | Restart after a configuration update reports a change. | | `pve_lxc_cmode` | `tty` | Console mode sent on update. | | `pve_lxc_raw_config` | `[]` | Raw `lxc.*` lines, one per item. See Notes. | | `pve_lxc_onboot` | `true` | Start on node boot, for `started` and `present`. A `stopped` container always gets `onboot=0`. | | `pve_lxc_node`, `pve_lxc_vmid` | none | Inventory name of the Proxmox node and container id. | | `pve_lxc_ostemplate` | none | Template volume, for example `local:vztmpl/