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
21 lines
676 B
YAML
21 lines
676 B
YAML
---
|
|
- name: Check if LXC exists
|
|
no_log: true # Authorization header carries the API token
|
|
delegate_to: localhost
|
|
ansible.builtin.uri:
|
|
url: "https://{{ pve_lxc_api_host }}:8006/api2/json/nodes/{{ pve_lxc_node }}/lxc/{{ pve_lxc_vmid }}/config"
|
|
method: GET
|
|
headers:
|
|
Authorization: "{{ __pve_lxc_api_auth_header }}"
|
|
status_code: [200, 404, 500]
|
|
register: __pve_lxc_config
|
|
check_mode: false
|
|
|
|
- name: Set LXC existence fact
|
|
ansible.builtin.set_fact:
|
|
pve_lxc_exists: "{{ __pve_lxc_config.status == 200 }}"
|
|
|
|
- name: Set public LXC presence API
|
|
ansible.builtin.set_fact:
|
|
pve_lxc_present: "{{ pve_lxc_exists and pve_lxc_state != 'absent' }}"
|