1
0
Fork 0

add usbip

This commit is contained in:
Massaki Archambault 2024-08-06 13:41:57 -04:00
parent d97b0f5712
commit 1aa03a7d37
7 changed files with 80 additions and 6 deletions

17
hosts
View File

@ -46,13 +46,19 @@ all:
name: jirost
level: 4
home-assistant:
hosts:
home-assistant:
ansible_host: 192.168.31.20
# hosts:
# home-assistant:
# ansible_host: 192.168.31.20
cups:
# hosts:
# cups:
# ansible_host: cups.local
usbip:
hosts:
cups:
ansible_host: cups.local
usbip:
ansible_host: 192.168.20.33
exposed_usb_devices:
- 2-1
k3s:
children:
k3s-server:
@ -93,6 +99,7 @@ all:
minecraft-server:
home-assistant:
cups:
usbip:
vars:
ansible_user: ansible
ansible_password: !vault |

View File

@ -48,4 +48,8 @@
- hosts: cups
roles:
- cups
- cups
- hosts: usbip
roles:
- usbip

View File

@ -1,3 +1,9 @@
- name: Install linux-tools
apt:
update_cache: true
name:
- linux-tools-generic
- name: Enable IOMMU
lineinfile:
path: /etc/default/grub

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