ham-hotspot/ansible/playbook.yml
2025-04-25 19:11:33 -05:00

121 lines
2.8 KiB
YAML

---
- name: Ham Hotspot Bootstrap
hosts: localhost
become: yes
vars_files:
- ../config/desired_state.yml
tasks:
- name: Install base apt packages
apt:
name:
- ax25-tools
- ax25-apps
- libax25
- dnsmasq
- hostapd
- python3-flask
- build-essential
- cmake
- git
state: present
update_cache: yes
- name: Clone Direwolf from GitHub
git:
repo: 'https://github.com/wb2osz/direwolf.git'
dest: /usr/local/src/direwolf
update: no
- name: Build Direwolf
shell: |
mkdir -p /usr/local/src/direwolf/build
cd /usr/local/src/direwolf/build
cmake ..
make -j4
args:
chdir: /usr/local/src/direwolf
creates: /usr/local/src/direwolf/build/direwolf
- name: Install Direwolf
shell: |
cd /usr/local/src/direwolf/build
make install
args:
chdir: /usr/local/src/direwolf/build
creates: /usr/local/bin/direwolf
- name: Copy systemd service templates
copy:
src: ../systemd/
dest: /lib/systemd/system/
mode: '0644'
owner: root
group: root
- name: Deploy Direwolf configuration
template:
src: ../templates/direwolf.conf.j2
dest: /etc/ham-hotspot/direwolf-{{ radio.port_name }}.conf
mode: '0644'
- name: Deploy hostapd configuration
template:
src: ../templates/hostapd.conf.j2
dest: /etc/hostapd/hostapd.conf
mode: '0644'
- name: Deploy dnsmasq configuration
template:
src: ../templates/dnsmasq.conf.j2
dest: /etc/dnsmasq.d/ham-hotspot.conf
mode: '0644'
- name: Deploy axports configuration
template:
src: ../templates/axports.j2
dest: /etc/ax25/axports
mode: '0644'
- name: Enable IP forwarding
copy:
dest: /etc/sysctl.d/ham-hotspot.conf
content: |
net.ipv4.ip_forward=1
mode: '0644'
- name: Reload systemd daemon
systemd:
daemon_reload: yes
- name: Enable and start Direwolf instance
systemd:
name: direwolf@radio0.service
enabled: yes
state: started
- name: Enable and start KISS TNC instance
systemd:
name: kisstnc@radio0.service
enabled: yes
state: started
- name: Enable and start AX.25 daemon
systemd:
name: ax25d.service
enabled: yes
state: started
- name: Enable and start hostapd
systemd:
name: hostapd.service
enabled: yes
state: started
- name: Enable and start dnsmasq
systemd:
name: dnsmasq.service
enabled: yes
state: started