Add pve_lxc, which manages the lifecycle of a Proxmox VE LXC container through the Proxmox API (community.proxmox), reconciles the raw lxc.* lines of its config on the node and, opt-in, writes its guest firewall file. It keeps the pve_lxc_* interface and carries no legacy-name guard. The input asserts run from tasks/validate.yml before any change, and the API token secret has no default. The molecule scenario runs the validation and the node-side task files against a container standing in for the node; the API lifecycle is not exercised. Debian trixie is declared, untested. Refs #386 Assisted-by: Claude Code:claude-opus-5-5
54 lines
2.3 KiB
YAML
54 lines
2.3 KiB
YAML
---
|
|
pve_lxc_state: present # present | started | stopped | absent
|
|
pve_lxc_manage_disk: false # disk resizing is explicit
|
|
pve_lxc_wait_for_ssh: true
|
|
pve_lxc_allow_destroy: false
|
|
# false = the LXC lives on a Proxmox node Ansible does not manage; skip the
|
|
# lifecycle tasks and treat the guest as present so it is still configured.
|
|
pve_lxc_manage_lifecycle: true
|
|
pve_lxc_onboot: true
|
|
# Restart the container after its root filesystem was grown.
|
|
pve_lxc_reboot_if_required: true
|
|
|
|
pve_lxc_pubkey: ""
|
|
|
|
# e.g. ["nesting=1", "keyctl=1"] to allow Docker/nested containers inside
|
|
# an unprivileged LXC. See https://pve.proxmox.com/wiki/Linux_Container#pct_options.
|
|
pve_lxc_features: []
|
|
|
|
# Proxmox applies some changes (features) only on the next start. Off by default, so routine
|
|
# config drift (netif, nameserver ...) does not restart guests.
|
|
pve_lxc_restart_on_config_change: false
|
|
|
|
pve_lxc_raw_config: []
|
|
|
|
# Console mode sent on update (tasks/update.yml says why it is sent explicitly).
|
|
pve_lxc_cmode: tty
|
|
|
|
# Proxmox API credentials. Only read when the LXC lifecycle is managed
|
|
# (pve_lxc_manage_lifecycle true); tasks/validate.yml then asserts that the user and
|
|
# the token secret are set. The user is the bare name: the role appends
|
|
# @<pve_lxc_api_realm>. The token secret, pve_lxc_api_token_secret, is a secret
|
|
# input with no default, normally vaulted.
|
|
pve_lxc_api_user: ""
|
|
pve_lxc_api_realm: pam
|
|
pve_lxc_api_token_id: "{{ pve_lxc_api_user }}-token"
|
|
# The Proxmox node's address. Guarded so the default templates to '' (and the
|
|
# argument validation passes) on a host without pve_lxc_node.
|
|
pve_lxc_api_host: "{{ hostvars[pve_lxc_node].ansible_host if pve_lxc_node is defined else '' }}"
|
|
|
|
# Container network interface name.
|
|
pve_lxc_net_interface: eth0
|
|
# Prefix length of ansible_host in net0. Environment-specific, so there is no
|
|
# real default: empty here, asserted in tasks/validate.yml.
|
|
pve_lxc_net_prefix: ""
|
|
|
|
# Proxmox guest firewall on net0, opt-in. Off: net0 carries no firewall flag
|
|
# and no /etc/pve/firewall/<vmid>.fw is written, so other containers are unchanged.
|
|
# The rules only filter while the datacenter firewall is enabled (README).
|
|
pve_lxc_firewall: false
|
|
pve_lxc_firewall_policy_in: DROP
|
|
pve_lxc_firewall_policy_out: DROP
|
|
# Proxmox rule lines, evaluated in order, e.g. "IN ACCEPT -source 192.0.2.5 -p tcp -dport 22".
|
|
pve_lxc_firewall_rules: []
|