This commit is contained in:
Craig McDaniel
2025-10-08 15:59:03 -05:00
parent 2bd3d99e0f
commit b46f86f4e0
8 changed files with 113 additions and 87 deletions
+4 -4
View File
@@ -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:
@@ -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
@@ -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"
@@ -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
@@ -7,7 +7,7 @@
# is disconnected.
[Unit]
Description=Direwolf TNC for %i
Description=Direwolf TNC for Yaesu FT-991a
[Service]
ExecStartPre=/bin/sleep 5
@@ -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": "",
+5 -5
View File
@@ -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."