-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicarus.yml
182 lines (150 loc) · 4.39 KB
/
icarus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
---
- hosts: localhost
tasks:
# Setup symlink that's used by some packages
- name: setup /opt/radiohound symlink
file:
src: /opt/radiohound
dest: /opt/icarus
owner: root
group: root
state: link
- name: Install Icarus Dependencies (Apt)
apt:
pkg:
- python3-pip
- python3-venv
- netcat
- autossh
- mosquitto
# - librtlsdr-dev
# - hackrf
# - libhackrf-dev
state: present
update_cache: no
- name: Create a virtual environment
command: python3 -m venv /opt/radiohound/venv
- name: Install Icarus Dependencies (Pip)
pip:
name:
- paho-mqtt>=1.5.1
- requests>=2.26.0
- serial>=0.0.97
- schedule>=0.6.0
- inotify>=0.2.10
- scipy>=1.8.0
- pytz>=2022.1
- numpy>=1.22.3
- pyvisa>=1.12.0
- PyVISA-py>=0.5.3
- psutil>=6.0.0
- gps>=3.19
state: present
virtualenv: /opt/radiohound/venv
virtualenv_python: python
- name: Add icarus user
user:
name: icarus
comment: Radiohound System Account
groups: "i2c"
shell: /bin/bash
- name: create icarus' .ssh directory
file:
path: /home/icarus/.ssh
state: directory
owner: icarus
group: icarus
mode: 0700
- name: copy ssh key to Icarus
copy:
src: /opt/radiohound/.ssh/id_rsa
dest: /home/icarus/.ssh/id_rsa
mode: 0600
owner: icarus
group: icarus
- name: create icarus directory
file:
path: /opt/radiohound
state: directory
owner: root
group: root
- name: clone icarus repository
git:
repo: [email protected]:ndwireless/icarus.git
dest: /opt/radiohound/icarus
update: no
key_file: /home/icarus/.ssh/id_rsa
accept_hostkey: yes
register: git_clone_icarus
- name: Add key to icarus repo
shell: GIT_DIR=/opt/radiohound/icarus/.git GIT_WORK_TREE=/opt/radiohound/icarus git config core.sshCommand "ssh -i /home/icarus/.ssh/id_rsa"
- name: Add git safe.directory to icarus repo
shell: GIT_DIR=/opt/radiohound/icarus/.git GIT_WORK_TREE=/opt/radiohound/icaurs git config --add safe.directory /opt/radiohound/icarus
- name: get latest tag
shell: "git describe --tags `git rev-list --tags --max-count=1`"
args:
chdir: /opt/radiohound/icarus
when: not git_clone_icarus.before
register: git_latest_tag
- name: checkout dev branch
git:
repo: [email protected]:ndwireless/icarus.git
dest: /opt/radiohound/icarus
update: yes
version: "dev"
when: not git_clone_icarus.before
# - name: checkout latest tag
# git:
# repo: [email protected]:ndwireless/icarus.git
# dest: /opt/radiohound/icarus
# update: yes
# version: "{{git_latest_tag.stdout}}"
# when: not git_clone_icarus.before
# become: yes
# become_user: icarus
- name: copy default system.json
copy:
src: /opt/ansible/files/system.json
dest: /opt/radiohound/icarus/
owner: icarus
group: icarus
force: no
# - name: setup scripts symlink
# file:
# src: /opt/radiohound/icarus_setup/ansible/files/scripts
# dest: /opt/radiohound/scripts
# owner: root
# group: root
# state: link
- name: create icarus' virtualenvs directory for compatibility
file:
path: /opt/icarus/.virtualenvs/python3.9/bin
state: directory
owner: icarus
group: icarus
mode: 0755
- name: Create a symbolic link
file:
src: /opt/radiohound/venv/bin/python3
dest: /opt/icarus/.virtualenvs/python3.9/bin/python
owner: icarus
group: icarus
state: link
- name: copy icarus service
copy:
src: "files/icarus.service"
dest: "/etc/systemd/system/"
owner: root
group: root
notify:
- systemctl reload
- start icarus daemon
handlers:
- name: systemctl reload
shell: /bin/systemctl daemon-reload
- name: start icarus daemon
systemd:
name: icarus
state: started
enabled: yes
...