1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
Massaki Archambault 4f90405092 add nvidia gpu drivers to k3s 2024-08-07 00:49:54 -04:00
Massaki Archambault 1aa03a7d37 add usbip 2024-08-06 13:41:57 -04:00
9 changed files with 100 additions and 8 deletions

19
hosts
View File

@ -23,6 +23,8 @@ all:
vfio_pci_ids: vfio_pci_ids:
- '1002:731f' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] - '1002:731f' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT]
- '1002:ab38' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio - '1002:ab38' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio
- '10de:13f1' # VGA compatible controller [0300]: NVIDIA Corporation GM204GL [Quadro M4000]
- '10de:0fbb' # Audio device [0403]: NVIDIA Corporation GM204 High Definition Audio Controller
bastion: bastion:
hosts: hosts:
bastion: bastion:
@ -46,13 +48,19 @@ all:
name: jirost name: jirost
level: 4 level: 4
home-assistant: home-assistant:
hosts: # hosts:
home-assistant: # home-assistant:
ansible_host: 192.168.31.20 # ansible_host: 192.168.31.20
cups: cups:
# hosts:
# cups:
# ansible_host: cups.local
usbip:
hosts: hosts:
cups: usbip:
ansible_host: cups.local ansible_host: 192.168.20.33
exposed_usb_devices:
- 2-1
k3s: k3s:
children: children:
k3s-server: k3s-server:
@ -93,6 +101,7 @@ all:
minecraft-server: minecraft-server:
home-assistant: home-assistant:
cups: cups:
usbip:
vars: vars:
ansible_user: ansible ansible_user: ansible
ansible_password: !vault | ansible_password: !vault |

View File

@ -49,3 +49,7 @@
- hosts: cups - hosts: cups
roles: roles:
- cups - cups
- hosts: usbip
roles:
- usbip

View File

@ -1 +1,2 @@
platform: lxc platform: lxc
nvidia_driver_branch: 550

View File

@ -7,3 +7,24 @@
group: root group: root
mode: 0755 mode: 0755
notify: reboot notify: reboot
# Begin nvidia
# https://dev.to/mweibel/add-nvidia-gpu-support-to-k3s-with-containerd-4j17
- name: Download nvidia repository gpg key
get_url:
url: https://nvidia.github.io/libnvidia-container/gpgkey
dest: /usr/share/keyrings/nvidia-container-toolkit-keyring.asc
- name: Add nvidia repository
apt_repository:
repo: deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.asc] https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
- name: Install nvidia drivers and nvidia container toolkit
apt:
update_cache: true
name:
- linux-modules-nvidia-{{ nvidia_driver_branch }}-server-generic
- nvidia-utils-{{ nvidia_driver_branch }}-server
- nvidia-container-toolkit
notify: reboot
# End nvidia

View File

@ -1 +1 @@
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription

View File

@ -0,0 +1 @@
exposed_usb_devices: []

View File

@ -0,0 +1,15 @@
[Unit]
Description=USB-IP Binding on bus id %I
After=network-online.target usbipd.service
Wants=network-online.target
Requires=usbipd.service
[Service]
Type=simple
ExecStart=/usr/bin/usbip bind -b %i
RemainAfterExit=yes
ExecStop=/usr/bin/usbip unbind -b %i
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=USB/IP server
After=network.target
[Service]
ExecStartPre=/usr/sbin/modprobe usbip-host
ExecStart=/usr/bin/usbipd
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,31 @@
- name: Install linux-tools-generic
apt:
update_cache: true
name:
- linux-tools-generic
- name: Install usbip systemd unit
copy:
src: usbipd.service
dest: /etc/systemd/system/usbipd.service
mode: 0644
register: copy_usbipd_unit
- name: Install usbip-bind systemd unit
copy:
src: usbip-bind@.service
dest: /etc/systemd/system/usbip-bind@.service
mode: 0644
register: copy_usbip_bind_unit
- name: Reload systemd
systemd:
daemon_reload: true
when: copy_usbipd_unit.changed or copy_usbip_bind_unit.changed
- name: Enable usbip units
with_items: "{{ exposed_usb_devices }}"
systemd:
name: "usbip-bind@{{ item }}.service"
state: started
enabled: true