add usbip
This commit is contained in:
parent
d97b0f5712
commit
1aa03a7d37
17
hosts
17
hosts
|
@ -46,13 +46,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 +99,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 |
|
||||||
|
|
|
@ -49,3 +49,7 @@
|
||||||
- hosts: cups
|
- hosts: cups
|
||||||
roles:
|
roles:
|
||||||
- cups
|
- cups
|
||||||
|
|
||||||
|
- hosts: usbip
|
||||||
|
roles:
|
||||||
|
- usbip
|
|
@ -1,3 +1,9 @@
|
||||||
|
- name: Install linux-tools
|
||||||
|
apt:
|
||||||
|
update_cache: true
|
||||||
|
name:
|
||||||
|
- linux-tools-generic
|
||||||
|
|
||||||
- name: Enable IOMMU
|
- name: Enable IOMMU
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /etc/default/grub
|
path: /etc/default/grub
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
exposed_usb_devices: []
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue