First fixes

This commit is contained in:
John Burwell 2025-04-25 19:56:20 -05:00
parent d3299f8848
commit c3a7ed97dd
6 changed files with 83 additions and 2 deletions

View File

@ -2,10 +2,14 @@
- name: Ham Hotspot Bootstrap - name: Ham Hotspot Bootstrap
hosts: localhost hosts: localhost
become: yes become: yes
connection: local
vars_files: vars_files:
- ../config/desired_state.yml - ../config/desired_state.yml
handlers:
- import_tasks: ../handlers/main.yml
tasks: tasks:
- name: Install base apt packages - name: Install base apt packages
apt: apt:
@ -19,6 +23,8 @@
- build-essential - build-essential
- cmake - cmake
- git - git
- alsa-utils
- libasound2-dev
state: present state: present
update_cache: yes update_cache: yes
@ -54,6 +60,14 @@
owner: root owner: root
group: root group: root
- name: Create /etc/ham-hotspot directory
file:
path: /etc/ham-hotspot
state: directory
mode: '0755'
owner: root
group: root
- name: Deploy Direwolf configuration - name: Deploy Direwolf configuration
template: template:
src: ../templates/direwolf.conf.j2 src: ../templates/direwolf.conf.j2
@ -65,12 +79,14 @@
src: ../templates/hostapd.conf.j2 src: ../templates/hostapd.conf.j2
dest: /etc/hostapd/hostapd.conf dest: /etc/hostapd/hostapd.conf
mode: '0644' mode: '0644'
notify: Restart hostapd
- name: Deploy dnsmasq configuration - name: Deploy dnsmasq configuration
template: template:
src: ../templates/dnsmasq.conf.j2 src: ../templates/dnsmasq.conf.j2
dest: /etc/dnsmasq.d/ham-hotspot.conf dest: /etc/dnsmasq.d/ham-hotspot.conf
mode: '0644' mode: '0644'
notify: Restart dnsmasq
- name: Deploy axports configuration - name: Deploy axports configuration
template: template:
@ -85,10 +101,45 @@
net.ipv4.ip_forward=1 net.ipv4.ip_forward=1
mode: '0644' mode: '0644'
- name: Unmask hostapd service
systemd:
name: hostapd
masked: no
- name: Ensure /etc/wpa_supplicant/wpa_supplicant.conf exists
file:
path: /etc/wpa_supplicant/wpa_supplicant.conf
state: touch
owner: root
group: root
mode: '0644'
- name: Ensure Wi-Fi country is set in wpa_supplicant.conf
blockinfile:
path: /etc/wpa_supplicant/wpa_supplicant.conf
marker: "# {mark} ANSIBLE MANAGED BLOCK - Wi-Fi Country Setting"
block: |
country={{ wifi.country }}
when: ansible_facts['distribution'] in ['Debian', 'Raspbian']
- name: Install unblock-wlan.service
copy:
src: ../systemd/unblock-wlan.service
dest: /etc/systemd/system/unblock-wlan.service
mode: '0644'
owner: root
group: root
- name: Reload systemd daemon - name: Reload systemd daemon
systemd: systemd:
daemon_reload: yes daemon_reload: yes
- name: Enable and start unblock-wlan.service
systemd:
name: unblock-wlan.service
enabled: yes
state: started
- name: Enable and start Direwolf instance - name: Enable and start Direwolf instance
systemd: systemd:
name: direwolf@radio0.service name: direwolf@radio0.service

View File

@ -1,6 +1,7 @@
# Configuration state for Ham Hotspot # Configuration state for Ham Hotspot
wifi: wifi:
country: US
ssid: HamHotspot ssid: HamHotspot
password: change_me_now password: change_me_now
channel: 6 channel: 6

18
handlers/main.yml Normal file
View File

@ -0,0 +1,18 @@
---
- name: Restart hostapd
systemd:
name: hostapd
state: restarted
enabled: yes
- name: Restart dnsmasq
systemd:
name: dnsmasq
state: restarted
enabled: yes
- name: Restart unblock-wlan service
systemd:
name: unblock-wlan.service
state: restarted
enabled: yes

View File

@ -5,7 +5,7 @@ After=direwolf@%i.service
AssertPathExists=/run/direwolf/%i AssertPathExists=/run/direwolf/%i
[Service] [Service]
Type=oneshot Type=simple
ExecStart=/usr/sbin/kissattach /run/direwolf/%i %i ExecStart=/usr/sbin/kissattach /run/direwolf/%i %i
ExecStartPost=/usr/sbin/kissparms -c 1 -p %i ExecStartPost=/usr/sbin/kissparms -c 1 -p %i
RemainAfterExit=true RemainAfterExit=true

View File

@ -0,0 +1,12 @@
[Unit]
Description=Unblock WiFi on boot
After=network-pre.target
Before=network.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/rfkill unblock wlan
RemainAfterExit=true
[Install]
WantedBy=multi-user.target

View File

@ -16,7 +16,6 @@ TXTAIL 10
DWAIT 0 DWAIT 0
SLOTTIME 100 SLOTTIME 100
PERSIST 63 PERSIST 63
FIX_BITS 1 AX25
# Log settings # Log settings
LOGDIR /var/log/direwolf LOGDIR /var/log/direwolf