chore: rename .yaml extensions to .yml for consistency
This commit is contained in:
43
roles/proxmox-lxc-provision/tasks/edit-config.yml
Executable file
43
roles/proxmox-lxc-provision/tasks/edit-config.yml
Executable file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
|
||||
- name: Remove all existing ID mappings
|
||||
lineinfile:
|
||||
path: "/etc/pve/lxc/{{ lxc_vmid }}.conf"
|
||||
regexp: '^lxc\.idmap:'
|
||||
state: absent
|
||||
when: lxc_id_mappings is defined
|
||||
|
||||
- name: Add ID mappings
|
||||
blockinfile:
|
||||
path: "/etc/pve/lxc/{{ lxc_vmid }}.conf"
|
||||
block: "{{ lxc_id_mappings }}"
|
||||
insertafter: EOF
|
||||
when: lxc_id_mappings is defined
|
||||
|
||||
- name: Remove existing GPU configuration
|
||||
lineinfile:
|
||||
path: "/etc/pve/lxc/{{ lxc_vmid }}.conf"
|
||||
regexp: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- '^lxc\.cgroup2\.devices\.allow: c {{ gpu_device_id }}:\* rwm'
|
||||
- '^lxc\.cgroup2\.devices\.allow: c {{ uvm_device_id }}:\* rwm'
|
||||
- '^lxc\.mount\.entry: /dev/nvidia0'
|
||||
- '^lxc\.mount\.entry: /dev/nvidiactl'
|
||||
- '^lxc\.mount\.entry: /dev/nvidia-uvm '
|
||||
- '^lxc\.mount\.entry: /dev/nvidia-uvm-tools'
|
||||
when: lxc_nvidia_gpu_mount
|
||||
|
||||
- name: Add GPU device for passthrough
|
||||
blockinfile:
|
||||
path: /etc/pve/lxc/{{ lxc_vmid }}.conf
|
||||
block: |
|
||||
lxc.cgroup2.devices.allow: c {{ gpu_device_id }}:* rwm
|
||||
lxc.cgroup2.devices.allow: c {{ uvm_device_id }}:* rwm
|
||||
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
|
||||
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
|
||||
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
|
||||
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
|
||||
when: lxc_nvidia_gpu_mount
|
||||
|
||||
|
||||
Reference in New Issue
Block a user