diff --git a/k3s/files/etc/salt/minion.d/beacons.conf b/k3s/files/etc/salt/minion.d/beacons.conf new file mode 100644 index 0000000..e88ab92 --- /dev/null +++ b/k3s/files/etc/salt/minion.d/beacons.conf @@ -0,0 +1,13 @@ +beacons: + inotify: + - files: + /dev: + mask: + - create + - delete + exclude: + - /dev/gpiochip3 + - /dev/serial + - /dev/ttyUSB0 + - /dev/ttyUSB1 + - disable_during_state_run: True diff --git a/k3s/files/etc/udev/rules.d/90-RFXtrx433.rules b/k3s/files/etc/udev/rules.d/90-RFXtrx433.rules new file mode 100644 index 0000000..5ccc71b --- /dev/null +++ b/k3s/files/etc/udev/rules.d/90-RFXtrx433.rules @@ -0,0 +1,5 @@ +SUBSYSTEM=="tty", \ +ACTION=="add", \ +DRIVERS=="ftdi_sio", \ +ATTRS{interface}=="RFXtrx433", \ +SYMLINK+="rfxtrx433" diff --git a/k3s/init.sls b/k3s/init.sls index 1ceddc2..0bb7f23 100644 --- a/k3s/init.sls +++ b/k3s/init.sls @@ -1,3 +1,4 @@ include: - k3s.firewalld - k3s.network + - k3s.usb-devices diff --git a/k3s/usb-devices.sls b/k3s/usb-devices.sls new file mode 100644 index 0000000..8913377 --- /dev/null +++ b/k3s/usb-devices.sls @@ -0,0 +1,30 @@ +Install PyInotify: + pkg.installed: + - name: python3-pyinotify + +Add the rfxcom433 beacon file: + file.managed: + - name: /etc/salt/minion.d/beacons.conf + - source: salt://k3s/files/etc/salt/minion.d/beacons.conf + - user: root + - group: root + - mode: "0644" + +Restart salt-minion: + service.running: + - name: salt-minion + - onchanges: + - file: Add the rfxcom433 beacon file + +Add the rfxcom udev rule: + file.managed: + - name: /etc/udev/rules.d/90-RFXtrx433.rules + - user: root + - group: root + - mode: "0644" + +reload udev rules: + cmd.run: + - name: udevadm control --reload + - onchanges: + - file: Add the rfxcom udev rule