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
22 lines
996 B
YAML
22 lines
996 B
YAML
---
|
|
# Written before the container is created, so its rules exist before net0 first comes up with
|
|
# firewall=1; pve-firewall picks up the change by itself. pmxcfs refuses a chmod to any mode but
|
|
# 0640, and template cannot create a new file there (its atomic move chmods the 0600 staging file).
|
|
# Over an existing file it keeps that file's 0640, so the file is created empty first: touch is a
|
|
# plain open(), and preserving the timestamps keeps it idempotent. Mode omitted: pmxcfs sets it.
|
|
- name: Create the guest firewall config file # noqa: risky-file-permissions
|
|
delegate_to: "{{ pve_lxc_node }}"
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "/etc/pve/firewall/{{ pve_lxc_vmid }}.fw"
|
|
state: touch
|
|
modification_time: preserve
|
|
access_time: preserve
|
|
|
|
- name: Write the guest firewall config # noqa: risky-file-permissions
|
|
delegate_to: "{{ pve_lxc_node }}"
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: firewall.fw.j2
|
|
dest: "/etc/pve/firewall/{{ pve_lxc_vmid }}.fw"
|