Files
Kamino/roles/pve_lxc/tasks/firewall.yml
T
Defame1297 318229bdb3
Build / build (pull_request) Successful in 48s
Lint / lint (pull_request) Failing after 3m17s
Molecule / molecule (pull_request) Failing after 4m2s
feat(pve_lxc): add the pve_lxc role
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
2026-11-25 22:55:25 +00:00

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"