fix(proxmox_lxc_provision): apply idmaps/GPU config via lineinfile, wire into flow
edit-config.yml was never included by the role, so lxc_id_mappings and GPU passthrough were silently ignored. It also used blockinfile, whose comment markers are incompatible with Proxmox hoisting all comments to the top of the .conf on every write -- which orphans the markers and empties the managed block. Rewrite edit-config.yml to manage raw lxc.* lines with lineinfile (keyed on each exact line, churn-free, immune to comment hoisting), delegated to the Proxmox host. Include it from main.yml after clone/create but before start.yml, while the container is stopped, since ID mappings can't change on a running container.
This commit is contained in:
@@ -32,6 +32,15 @@
|
||||
file: create.yml
|
||||
when: lxc_template is defined and lxc_clone_from is undefined
|
||||
|
||||
# Must run while the container is stopped (before start.yml): ID mappings cannot be
|
||||
# changed on a running container. Writes /etc/pve/lxc/<vmid>.conf on the Proxmox host.
|
||||
- name: Apply raw LXC config (ID mappings, GPU passthrough)
|
||||
ansible.builtin.include_tasks:
|
||||
file: edit-config.yml
|
||||
vars:
|
||||
lxc_vmid: "{{ lxc_result.vmid | default(lxc_vmid) }}"
|
||||
when: lxc_id_mappings is defined or lxc_nvidia_gpu_mount
|
||||
|
||||
- name: Start the created container and wait for ssh
|
||||
vars:
|
||||
lxc_vmid: "{{ lxc_result.vmid }}"
|
||||
|
||||
Reference in New Issue
Block a user