Skip to content

Commit

Permalink
rewrite to support ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
ampledata committed Aug 15, 2024
1 parent 13861f8 commit 4590c95
Show file tree
Hide file tree
Showing 308 changed files with 3,936 additions and 9,171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: |
mkdir -p .debpkg/home/node-red/.node-red
ls -alR
cp stage5-common/00-install/files/AryaOS_flows.json .debpkg/home/node-red/.node-red/flows.json
cp shared_files/node_red/aryaos_flows.json .debpkg/home/node-red/.node-red/flows.json
# create DEBIAN directory if you want to add other pre/post scripts
mkdir -p .debpkg/DEBIAN
echo -e "chown node-red:node-red /home/node-red/.node-red/flows.json" > .debpkg/DEBIAN/postinst
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pi-gen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build pi-gen image

on:
push:
tags:
- 'v*.*.*'

jobs:
pi-gen-aryaos:
runs-on: ubuntu-latest
steps:
- name: dotenv
uses: falti/[email protected]
with:
path: ./pi-gen/config
- uses: usimd/pi-gen-action@v1
with:
# Disable the renaming of the first user during the first boot. This make it so
# 'username' stays activated. 'username' must be set for this to work. Please be
# aware of the implied security risk of defining a default username and password
# for your devices.
disable-first-boot-user-rename: 1

# Enable SSH access to Pi.
enable-ssh: 1

image-name: test
stage-list: stage0 stage1 stage2 ./test-stage
34 changes: 0 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,6 @@
#


build: pi-gen
sudo ./build.sh

pi-gen:
git clone --branch arm64 https://github.com/RPI-Distro/pi-gen.git
touch ./pi-gen/stage2/SKIP_IMAGES ./pi-gen/stage2/SKIP_NOOBS

copy:
rsync -va ../aryaos kelp.local:~/src/SNS/
# rsync -va ../aryaos titan2.local:~/src/SNS/

sync: copy

skip:
touch pi-gen/stage0/SKIP
touch pi-gen/stage1/SKIP
touch pi-gen/stage2/SKIP

unskip:
rm -f */SKIP
rm -f pi-gen/*/SKIP

copyback:
scp pi-gen/deploy/image*.zip [email protected]:~

skip3:
touch stage3*/SKIP

skip4:
touch stage4*/SKIP

skip5:
touch stage5*/SKIP

mkdocs:
pip install -r docs/requirements.txt
mkdocs serve
3 changes: 3 additions & 0 deletions ansible/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "/Users/gba/.pyenv/versions/3.10.4/envs/ansible/bin/python"
}
2 changes: 2 additions & 0 deletions ansible/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aryaaio:
ansible-playbook -i inventory.yml -e '@secret' site.yml -l aryaaio
1,019 changes: 1,019 additions & 0 deletions ansible/ansible.cfg

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions stage9-docker/00-prepare/01-run-chroot.sh → ansible/inventory.yml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash -e
# AryaOS 01-run-chroot.sh
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -14,4 +14,7 @@
# limitations under the License.
#

apt update
all:
hosts:
aryaaio:
ansible_host: 172.17.2.204
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# AryaOS AryaOS-config.txt
#
# AryaOS Env configuration file.
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,8 +14,16 @@
# limitations under the License.
#

COT_URL=udp+wo://239.2.3.1:6969
PYTAK_MULTICAST_LOCAL_ADDR=10.41.0.1
WIFI_AP_IP=10.41.0.1
NODE_ID=""
AOS_SERVICES="ADSBCOT LINCOT AISCOT DroneCOT nodered readsb"
- name: First Playbook
hosts: all
tasks:
- name: Ping my hosts
ansible.builtin.ping:
- name: Print message
ansible.builtin.debug:
msg: Hello world
- name: Disk usage from command module
command: df -h
register: space
- debug:
var: space.stdout_lines
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# AryaOS DroneCOT-config.txt
# code: language=ansible
#
# DroneCOT Env configuration file.
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,3 +15,12 @@
# limitations under the License.
#

- name: Restart ADSBCOT
ansible.builtin.service:
name: adsbcot
state: restarted

- name: Restart READSB
ansible.builtin.service:
name: readsb
state: restarted
34 changes: 34 additions & 0 deletions ansible/roles/adsbcot/tasks/adsbcot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# code: language=ansible
# adsbcot.yml - Install ADSBCOT.
#
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

- name: Download ADSBCOT Debian package
ansible.builtin.get_url:
url: "{{ adsbcot_deb_url }}"
dest: /usr/src/{{ adsbcot_deb }}
mode: "0644"

- name: Install ADSBCOT Debian package
ansible.builtin.apt:
deb: /usr/src/{{ adsbcot_deb }}

- name: Update ADSBCOT FEED_URL
ansible.builtin.replace:
path: /etc/default/adsbcot
regexp: '^.*FEED_URL=.*$'
replace: 'FEED_URL=file:///run/readsb/aircraft.json'
notify: Restart ADSBCOT
18 changes: 9 additions & 9 deletions stage8-uas/EXPORT_IMAGE → ansible/roles/adsbcot/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# AryaOS EXPORT_IMAGE
# code: language=ansible
#
# Export image configuration for AryaOS
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,8 +15,8 @@
# limitations under the License.
#

IMG_SUFFIX="-build"
- name: Include adsbcot
ansible.builtin.include_tasks: adsbcot.yml

if [ "${USE_QEMU}" = "1" ]; then
export IMG_SUFFIX="${IMG_SUFFIX}-qemu"
fi
- name: Include readsb
ansible.builtin.include_tasks: readsb.yml
34 changes: 34 additions & 0 deletions ansible/roles/adsbcot/tasks/readsb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# code: language=ansible
# readsb.yml - Install READSB.
#
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

- name: Download READSB Debian package
ansible.builtin.get_url:
url: "{{ readsb_deb_url }}"
dest: /usr/src/{{ readsb_deb }}
mode: "0644"

- name: Install READSB Debian package
ansible.builtin.apt:
deb: /usr/src/{{ readsb_deb }}

- name: Set SDR S/N in READSB config
ansible.builtin.replace:
path: /etc/default/readsb
regexp: '^RECEIVER_OPTIONS.*$'
replace: 'RECEIVER_OPTIONS="--device {{ adsb_sdr_sn }} --device-type rtlsdr --gain -10 --ppm 0"'
notify: Restart READSB
65 changes: 65 additions & 0 deletions ansible/roles/aiscot/tasks/ais-catcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# code: language=ansible
# ais-catcher.yml - Build & Install AIS-catcher.
#
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

- name: Extract AIS-catcher source
ansible.builtin.unarchive:
src: "{{ shared_files }}/ais/AIS-catcher-main.zip"
dest: /usr/src
creates: /usr/src/AIS-catcher-main

- name: Create AIS-catcher build directory
ansible.builtin.file:
path: /usr/src/AIS-catcher-main/build
state: directory
mode: "0755"

- name: Build AIS-catcher
ansible.builtin.shell:
cmd: |
cmake ..
make
make install
creates: /usr/local/bin/AIS-catcher
chdir: /usr/src/AIS-catcher-main/build

- name: Copy AIS-catcher systemd config
ansible.builtin.copy:
src: "{{ shared_files }}/ais/AIS-catcher.service"
dest: /lib/systemd/system/ais-catcher.service
mode: "0644"

- name: Copy AIS-catcher default config
ansible.builtin.copy:
src: ../../AIS-catcher.default.conf
dest: /etc/default/ais-catcher
mode: "0644"

- name: Add ais-catcher to dialout (USB access)
ansible.builtin.user:
name: aiscatcher
groups: dialout
comment: ais-catcher system user
append: true
system: true
create_home: false

- name: Enable AIS-catcher service
ansible.builtin.systemd_service:
name: ais-catcher.service
enabled: true
daemon_reload: true
32 changes: 14 additions & 18 deletions stage7-sea/00-install/files/run_AISCOT.sh → ansible/roles/aiscot/tasks/aiscot.yml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
# AryaOS run_AISCOT.sh
# code: language=ansible
# aiscot.yml - Install AISCOT.
#
# Startup file for AISCOT.
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -16,17 +16,13 @@
# limitations under the License.
#

set -a
AOS_CONFIG="/boot/${AOS_FLAVOR:-AryaOS}-config.txt"
AISCOT_CONFIG="/boot/AISCOT-config.txt"

if [ -f $AOS_CONFIG ]; then
. $AOS_CONFIG
fi

if [ -f $AISCOT_CONFIG ]; then
. $AISCOT_CONFIG
fi
- name: Download AISCOT Debian package
ansible.builtin.get_url:
url: "{{ aiscot_deb_url }}"
dest: /usr/src/{{ aiscot_deb }}
mode: "0644"

set +a
/usr/local/bin/aiscot
- name: Install AISCOT Debian package
ansible.builtin.apt:
deb: /usr/src/{{ aiscot_deb }}
Loading

0 comments on commit 4590c95

Please sign in to comment.