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
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
---
|
|
# Seeds the node-side files the converge reconciles: a container config with stale lxc.* lines,
|
|
# blockinfile markers of an earlier block and a snapshot section, plus backup copies of this
|
|
# container's config and of another one's.
|
|
- name: Prepare
|
|
hosts: all
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Create the Proxmox config directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
loop:
|
|
- /etc/pve/lxc
|
|
- /etc/pve/firewall
|
|
|
|
- name: Seed the container config
|
|
ansible.builtin.copy:
|
|
dest: /etc/pve/lxc/9100.conf
|
|
mode: "0640"
|
|
content: |
|
|
#molecule test container
|
|
arch: amd64
|
|
cores: 1
|
|
lxc.cgroup2.devices.allow: c 10:200 rwm
|
|
# BEGIN ANSIBLE MANAGED BLOCK (lxc_raw_config)
|
|
lxc.mount.entry: /srv/old srv/old none bind,create=dir 0 0
|
|
# END ANSIBLE MANAGED BLOCK (lxc_raw_config)
|
|
memory: 512
|
|
net0: name=eth0,bridge=vmbr0,ip=192.0.2.20/24,gw=192.0.2.1
|
|
rootfs: local-lvm:vm-9100-disk-0,size=8G
|
|
|
|
[before-upgrade]
|
|
arch: amd64
|
|
lxc.mount.entry: /srv/snap srv/snap none bind,create=dir 0 0
|
|
memory: 512
|
|
|
|
- name: Seed backup copies of two container configs
|
|
ansible.builtin.copy:
|
|
dest: "/etc/pve/lxc/{{ item }}"
|
|
mode: "0640"
|
|
content: "stale\n"
|
|
loop:
|
|
- "9100.conf.1234.2026-01-01@00:00:00~"
|
|
- "9101.conf.1234.2026-01-01@00:00:00~"
|