From b46f86f4e0cbaa84861f7978e6b3998025434483 Mon Sep 17 00:00:00 2001 From: Craig McDaniel Date: Wed, 8 Oct 2025 15:59:03 -0500 Subject: [PATCH] updates --- ansible/playbooks/scanner/scanner.yml | 8 +- .../tasks/main.yml | 148 ++++++++++-------- .../tasks/ubuntu_noble.yml | 0 .../templates/99-ft991a-udev.rules.j2} | 22 +-- .../templates/ft991a-direwolf.conf.j2 | 6 +- .../templates/ft991a-direwolf.service.j2 | 2 +- .../scanner_pat/templates/config.json.j2 | 4 +- orchestrate/ansible.sh | 10 +- 8 files changed, 113 insertions(+), 87 deletions(-) rename ansible/roles/{scanner_direwolf => scanner_ft991a}/tasks/main.yml (59%) rename ansible/roles/{scanner_direwolf => scanner_ft991a}/tasks/ubuntu_noble.yml (100%) rename ansible/roles/{scanner_direwolf/templates/99-ft991a-direwolf.rules.j2 => scanner_ft991a/templates/99-ft991a-udev.rules.j2} (61%) rename ansible/roles/{scanner_direwolf => scanner_ft991a}/templates/ft991a-direwolf.conf.j2 (75%) rename ansible/roles/{scanner_direwolf => scanner_ft991a}/templates/ft991a-direwolf.service.j2 (88%) diff --git a/ansible/playbooks/scanner/scanner.yml b/ansible/playbooks/scanner/scanner.yml index 44f79ee..d08113b 100644 --- a/ansible/playbooks/scanner/scanner.yml +++ b/ansible/playbooks/scanner/scanner.yml @@ -2,7 +2,7 @@ # --- -- name: Install and Configure Direwolf on scanner.busnet +- name: Install and Configure Various Things on scanner.busnet hosts: scanner.busnet become: true gather_facts: true @@ -12,10 +12,10 @@ name: hamlib when: run_hamlib is defined and run_hamlib | bool - - name: Direwolf + - name: Set up udev rules, rigctld and direwolf for Yaesu FT991-A ansible.builtin.import_role: - name: scanner_direwolf - when: run_direwolf is defined and run_direwolf | bool + name: scanner_ft991a + when: run_ft991a is defined and run_ft991a | bool - name: Pat ansible.builtin.import_role: diff --git a/ansible/roles/scanner_direwolf/tasks/main.yml b/ansible/roles/scanner_ft991a/tasks/main.yml similarity index 59% rename from ansible/roles/scanner_direwolf/tasks/main.yml rename to ansible/roles/scanner_ft991a/tasks/main.yml index 2326ca2..8042d16 100644 --- a/ansible/roles/scanner_direwolf/tasks/main.yml +++ b/ansible/roles/scanner_ft991a/tasks/main.yml @@ -36,14 +36,94 @@ - audio - plugdev +################################################################################################### +# Compile and install Direwolf from source +################################################################################################### + +#- name: Install correct prerequite packages when running Ubuntu Noble +# ansible.builtin.include_tasks: ubuntu_noble.yml +# when: ansible_distribution == "Ubuntu" and ansible_distribution_release == "noble" + +#- name: Git stuff +# ansible.builtin.command: +# cmd: "git config --global --add safe.directory /opt/busnet/direwolf/source" + +#- name: Checkout direwolf source +# ansible.builtin.git: +# repo: "https://www.github.com/wb2osz/direwolf" +# dest: /opt/busnet/direwolf/source +# version: 1.7 + +#- name: Create the build directory +# ansible.builtin.file: +# path: /opt/busnet/direwolf/source/build +# state: directory +# mode: '0755' + +#- name: Configure the build with cmake +# ansible.builtin.command: +# cmd: "cmake .." +# chdir: /opt/busnet/direwolf/source/build + +#- name: Build direwolf +# ansible.builtin.command: +# cmd: "make -j4" +# chdir: /opt/busnet/direwolf/source/build + +#- name: make install +# community.general.make: +# chdir: /opt/busnet/direwolf/source/build +# target: install + +- name: Copy Direwolf config for Yaesu FT-991a + template: + src: "templates/ft991a-direwolf.conf.j2" + dest: "/opt/busnet/direwolf/config/ft991a.conf" + owner: busnet + group: busnet + +################################################################################################### +# SYSTEMD +################################################################################################### + +# udev rules start this automatically when the radio USB is connected, and stop when disconnected. +- name: Install systemd unit file for rigctld and Yaesu FT-991a + template: + src: "templates/ft991a-rigctld.service.j2" + dest: "/etc/systemd/system/ft991a-rigctld.service" + owner: root + group: root + mode: "0644" + +- name: Enable ft991a-rigctld service + systemd: + name: "ft991a-rigctld" + daemon_reload: true + enabled: true + +# udev rules start this automatically when the radio USB is connected, and stop when disconnected. +- name: Install systemd unit file for Direwolf and Yaesu FT-991a + template: + src: "templates/ft991a-direwolf.service.j2" + dest: "/etc/systemd/system/ft991a-direwolf.service" + owner: root + group: root + mode: "0644" + +- name: Enable ft991a-direwolf service + systemd: + name: "ft991a-direwolf" + daemon_reload: true + enabled: true + ################################################################################################### # UDEV RULES ################################################################################################### - name: Copy udev rules for Yaesu FT-991a radio USB interface template: - src: templates/99-ft991a-direwolf.rules.j2 - dest: /etc/udev/rules.d/99-ft991a-direwolf.rules + src: templates/99-ft991a-udev.rules.j2 + dest: /etc/udev/rules.d/99-ft991a-udev.rules owner: root group: root register: ft991a_udev_result @@ -57,67 +137,3 @@ ansible.builtin.command: cmd: "udevadm trigger" when: ft991a_udev_result.changed - -################################################################################################### -# Compile and install Direwolf from source -################################################################################################### - -- name: Install correct prerequite packages when running Ubuntu Noble - ansible.builtin.include_tasks: ubuntu_noble.yml - when: ansible_distribution == "Ubuntu" and ansible_distribution_release == "noble" - -- name: Git stuff - ansible.builtin.command: - cmd: "git config --global --add safe.directory /opt/busnet/direwolf/source" - -- name: Checkout direwolf source - ansible.builtin.git: - repo: "https://www.github.com/wb2osz/direwolf" - dest: /opt/busnet/direwolf/source - version: 1.7 - -- name: Create the build directory - ansible.builtin.file: - path: /opt/busnet/direwolf/source/build - state: directory - mode: '0755' - -- name: Configure the build with cmake - ansible.builtin.command: - cmd: "cmake .." - chdir: /opt/busnet/direwolf/source/build - -- name: Build direwolf - ansible.builtin.command: - cmd: "make -j4" - chdir: /opt/busnet/direwolf/source/build - -- name: make install - community.general.make: - chdir: /opt/busnet/direwolf/source/build - target: install - -- name: Copy Direwolf config for Yaesu FT-991a - template: - src: "templates/ft991a-direwolf.conf.j2" - dest: "/opt/busnet/direwolf/config/ft991a.conf" - owner: busnet - group: busnet - -################################################################################################### -# SYSTEMD -################################################################################################### - -- name: Install systemd unit file for Yaesu FT-991a - template: - src: "templates/ft991a-direwolf.service.j2" - dest: "/etc/systemd/system/ft991a-direwolf.service" - owner: root - group: root - mode: "0644" - -- name: Enable ft991a-direwolf service - systemd: - name: "ft991a-direwolf" - daemon_reload: true - enabled: true \ No newline at end of file diff --git a/ansible/roles/scanner_direwolf/tasks/ubuntu_noble.yml b/ansible/roles/scanner_ft991a/tasks/ubuntu_noble.yml similarity index 100% rename from ansible/roles/scanner_direwolf/tasks/ubuntu_noble.yml rename to ansible/roles/scanner_ft991a/tasks/ubuntu_noble.yml diff --git a/ansible/roles/scanner_direwolf/templates/99-ft991a-direwolf.rules.j2 b/ansible/roles/scanner_ft991a/templates/99-ft991a-udev.rules.j2 similarity index 61% rename from ansible/roles/scanner_direwolf/templates/99-ft991a-direwolf.rules.j2 rename to ansible/roles/scanner_ft991a/templates/99-ft991a-udev.rules.j2 index c4f9041..5acce0c 100644 --- a/ansible/roles/scanner_direwolf/templates/99-ft991a-direwolf.rules.j2 +++ b/ansible/roles/scanner_ft991a/templates/99-ft991a-udev.rules.j2 @@ -1,4 +1,4 @@ -# udev rule to provide fixed device name for the Yeasu FT-991a +# udev rule to provide fixed device name for the Yeasu FT-991a and start/stop services automatically! # This information was retrieved by the following. Assuming the radio USB is hooked up to /dev/ttyUSB0 # @@ -6,20 +6,24 @@ # E: ID_SERIAL=Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_01A9F7D6 # E: ID_SERIAL_SHORT=01A9F7D6 # + + # This creates /dev/radio/ft991a-00 (CAT control) and /dev/radio/ft991a-01 (sound) -# It does not matter what USB port it's plugged into, or how many other USB devices are also plugged -# in. +# It does not matter what USB port it's plugged into, or how many other USB devices are also plugged in. # --------------------------------------------------------------------------------------------------- SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="01A9F7D6", SYMLINK+="radio/ft991a-$env{ID_USB_INTERFACE_NUM}", MODE="660", GROUP="plugdev" -# This works by triggering systemd service when the Yaesu 991a USB device USB appears. We identify -# the device by the unique serial number. + +# Automatically start rigctld and direwolf when the radio is connected. Identify the radio by the +# unique setial number. +# - This direwolf instance is only for this radio. +# - This rigctld instance is only for this radio. # --------------------------------------------------------------------------------------------------- +ACTION=="add", SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="01A9F7D6", TAG+="systemd" ENV{SYSTEMD_WANTS}+="ft991a-rigctld.service" ACTION=="add", SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="01A9F7D6", TAG+="systemd" ENV{SYSTEMD_WANTS}+="ft991a-direwolf.service" -# This tells systemd to shut down the direwolf service when the Yeasu 991a device disappears. We -# identify the device by the unique serial number. Remove the service from SYSTEMD_WANTS ENV. +# Automatically stop rigctld and direwolf when the radio is connected. # --------------------------------------------------------------------------------------------------- -ACTION=="remove", SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="01A9F7D6",TAG+="systemd" ENV{SYSTEMD_WANTS}-="ft991a-direwolf.service" - +ACTION=="remove", SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="01A9F7D6",TAG+="systemd" ENV{SYSTEMD_WANTS}-="ft991a-rigctld.service" +ACTION=="remove", SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="01A9F7D6",TAG+="systemd" ENV{SYSTEMD_WANTS}-="ft991a-direwolf.service" \ No newline at end of file diff --git a/ansible/roles/scanner_direwolf/templates/ft991a-direwolf.conf.j2 b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.conf.j2 similarity index 75% rename from ansible/roles/scanner_direwolf/templates/ft991a-direwolf.conf.j2 rename to ansible/roles/scanner_ft991a/templates/ft991a-direwolf.conf.j2 index 5245dbc..edd27d3 100644 --- a/ansible/roles/scanner_direwolf/templates/ft991a-direwolf.conf.j2 +++ b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.conf.j2 @@ -12,7 +12,11 @@ ADEVICE plughw:CODEC,0 # The custom udev rule makes this device available by name. PTT /dev/radio/ft991a-01 RTS -#PTT RIG 1035 /dev/radio/ft991a-00 + +# Use rigctld that is running specifically for this FT-991a radio. +# The 2 means use the rigctld daemon that's already running. +# This doesn't work. It keys PTT but doesn't trasmit any audio. *shrug* +#PTT RIG 2 localhost:4000 MYCALL K0BIT-1 KISSPORT 8001 diff --git a/ansible/roles/scanner_direwolf/templates/ft991a-direwolf.service.j2 b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.service.j2 similarity index 88% rename from ansible/roles/scanner_direwolf/templates/ft991a-direwolf.service.j2 rename to ansible/roles/scanner_ft991a/templates/ft991a-direwolf.service.j2 index f6477d4..2344c48 100644 --- a/ansible/roles/scanner_direwolf/templates/ft991a-direwolf.service.j2 +++ b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.service.j2 @@ -7,7 +7,7 @@ # is disconnected. [Unit] -Description=Direwolf TNC for %i +Description=Direwolf TNC for Yaesu FT-991a [Service] ExecStartPre=/bin/sleep 5 diff --git a/ansible/roles/scanner_pat/templates/config.json.j2 b/ansible/roles/scanner_pat/templates/config.json.j2 index 7b50650..deaea02 100644 --- a/ansible/roles/scanner_pat/templates/config.json.j2 +++ b/ansible/roles/scanner_pat/templates/config.json.j2 @@ -15,7 +15,9 @@ "telnet": "telnet://{mycall}:CMSTelnet@cms.winlink.org:8772/wl2k" }, "listen": [], - "hamlib_rigs": {}, + "hamlib_rigs": { + "ft-991a": {"address": "localhost:4000", "network": "tcp"} + }, "ax25": { "engine": "linux", "rig": "", diff --git a/orchestrate/ansible.sh b/orchestrate/ansible.sh index bd79459..7af2185 100755 --- a/orchestrate/ansible.sh +++ b/orchestrate/ansible.sh @@ -30,7 +30,7 @@ show_help() echo echo "scanner.busnet:" echo "---------------------------------------------------------------------------------------------------------------" - echo " --scanner-direwolf Install and configure direwolf on scanner.busnet" + echo " --scanner-ft991a Set up udev rules, rigctld and direwolf for the Yaesu FT-991a radio" echo " --scanner-pat Install and configure pat winlink client on scanner.busnet" echo " --scanner-hamlib Install and configure direwolf on scanner.busnet" echo @@ -50,8 +50,8 @@ main() elif [ "${COMMAND}" = "--build" ]; then ansible_build - elif [ "${COMMAND}" = "--scanner-direwolf" ]; then - scanner_direwolf + elif [ "${COMMAND}" = "--scanner-ft991a" ]; then + scanner_ft991a elif [ "${COMMAND}" = "--scanner-hamlib" ]; then scanner_hamlib @@ -113,9 +113,9 @@ ansible_bootstrap_server() } -scanner_direwolf() +scanner_ft991a() { - ansible_playbook playbooks/scanner/scanner.yml run_direwolf=1 + ansible_playbook playbooks/scanner/scanner.yml run_ft991a=1 if [ $? != 0 ]; then echo echo "Ansible playbook execution failed."