|
1 | 1 | --- |
2 | 2 | # For prometheus scrape requests |
3 | | -- name: Flush all handlers |
| 3 | +- name: Flush all handlers |
4 | 4 | meta: flush_handlers |
5 | 5 |
|
6 | 6 | - name: Allow traffic on port 9100 |
|
12 | 12 | block: | |
13 | 13 | add rule inet filter input tcp dport 9100 counter accept comment "node exporter" |
14 | 14 | notify: |
15 | | - - reload nftables |
| 15 | + - reload nftables |
16 | 16 |
|
17 | 17 | # For incoming fastpath traffic |
18 | 18 | - name: Allow traffic on port 8472 |
|
24 | 24 | block: | |
25 | 25 | add rule inet filter input tcp dport 8472 counter accept comment "fastpath" |
26 | 26 | notify: |
27 | | - - reload nftables |
| 27 | + - reload nftables |
28 | 28 |
|
29 | 29 | # For serving jsonl files |
30 | 30 | - name: Allow traffic on port 8475 |
|
36 | 36 | block: | |
37 | 37 | add rule inet filter input tcp dport 8475 counter accept comment "serve measurement spool" |
38 | 38 | notify: |
39 | | - - reload nftables |
| 39 | + - reload nftables |
40 | 40 |
|
41 | 41 | # Docker seems to have problems with nftables, so this command will translate all iptables |
42 | 42 | # commands to nftables commands |
43 | | -- name: Update alternatives for iptables |
44 | | - tags: docker |
45 | | - become: yes |
46 | | - ansible.builtin.command: "update-alternatives --set iptables /usr/sbin/iptables-nft" |
47 | | - notify: |
48 | | - - restart docker |
49 | | - |
50 | | -- name: Update alternatives for iptables |
51 | | - tags: docker |
52 | | - become: yes |
53 | | - ansible.builtin.command: "update-alternatives --set ip6tables /usr/sbin/ip6tables-nft" |
54 | | - notify: |
55 | | - - restart docker |
56 | | - |
57 | | -- name: Flush all handlers # Required to apply iptables settings before docker runs |
58 | | - meta: flush_handlers |
59 | | - |
60 | | -### Create fastpath user |
| 43 | +# - name: Update alternatives for iptables |
| 44 | +# tags: docker |
| 45 | +# become: yes |
| 46 | +# ansible.builtin.command: "update-alternatives --set iptables /usr/sbin/iptables-nft" |
| 47 | +# notify: |
| 48 | +# - restart docker |
| 49 | + |
| 50 | +# - name: Update alternatives for iptables |
| 51 | +# tags: docker |
| 52 | +# become: yes |
| 53 | +# ansible.builtin.command: "update-alternatives --set ip6tables /usr/sbin/ip6tables-nft" |
| 54 | +# notify: |
| 55 | +# - restart docker |
| 56 | + |
| 57 | +# - name: Flush all handlers # Required to apply iptables settings before docker runs |
| 58 | +# meta: flush_handlers |
| 59 | + |
| 60 | +### Create fastpath user |
61 | 61 | - name: Ensure the fastpath group exists |
62 | 62 | ansible.builtin.group: |
63 | 63 | name: "{{ fastpath_user }}" |
|
103 | 103 | owner: "{{fastpath_user}}" |
104 | 104 | become: yes |
105 | 105 |
|
106 | | -- name: Ensure ooniapi directory existence |
| 106 | +- name: Ensure ooniapi directory existence |
107 | 107 | ansible.builtin.file: |
108 | 108 | path: /var/lib/ooniapi |
109 | 109 | state: directory |
110 | | - mode: "0750" |
| 110 | + mode: "0711" |
111 | 111 | owner: "{{fastpath_user}}" |
112 | 112 | group: "{{fastpath_user}}" |
113 | 113 |
|
|
119 | 119 | owner: "{{fastpath_user}}" |
120 | 120 | group: "{{fastpath_user}}" |
121 | 121 |
|
122 | | -- name: Allow nginx access to the spool dir |
| 122 | +- name: Allow nginx access to the spool dir |
123 | 123 | become: true |
124 | 124 | ansible.builtin.user: |
125 | 125 | name: nginx |
|
139 | 139 | - name: Ensure fastpath is running |
140 | 140 | community.docker.docker_container: |
141 | 141 | name: fastpath |
142 | | - image: ooni/fastpath:v0.87 |
| 142 | + image: ooni/fastpath:v0.88 |
143 | 143 | state: started |
144 | 144 | user: "{{user_uid.stdout}}:{{user_gid.stdout}}" |
145 | | - # use network mode = host to allow traffic from fastpath to the statsd exporter without |
| 145 | + # use network mode = host to allow traffic from fastpath to the statsd exporter without |
146 | 146 | # creating a network with redirection rules to match the ports |
147 | | - network_mode: host |
| 147 | + network_mode: host |
148 | 148 | # published_ports: # unused on network_mode: host |
149 | 149 | # - "8472:8472" |
150 | 150 | volumes: |
151 | 151 | - /opt/{{fastpath_user}}/backend/fastpath/fastpath.conf:/etc/ooni/fastpath.conf |
152 | 152 | - /var/lib/ooniapi:/var/lib/ooniapi |
153 | 153 | - /var/lib/fastpath:/var/lib/fastpath |
| 154 | + tags: |
| 155 | + - fastpath |
154 | 156 |
|
155 | | -### Serve jsonl from spool dir for oonimeasurements |
| 157 | +### Serve jsonl from spool dir for oonimeasurements |
156 | 158 | - name: Add nginx config file for serving spool dir measurements |
157 | 159 | tags: fastpath |
158 | 160 | template: |
|
161 | 163 | mode: "0444" |
162 | 164 | owner: nginx |
163 | 165 | become: yes |
164 | | - notify: |
| 166 | + notify: |
165 | 167 | - reload nginx |
166 | 168 |
|
167 | 169 | - name: Ensure the statsd to prometheus exporter is running |
168 | 170 | community.docker.docker_container: |
169 | 171 | name: statsd-exporter |
170 | 172 | image: prom/statsd-exporter:v0.28.0 |
171 | 173 | state: started |
172 | | - published_ports: |
| 174 | + published_ports: |
173 | 175 | - "9102:9102" # for /metrics |
174 | | - - "8125:9125" # for reporting metrics |
| 176 | + - "8125:9125" # for reporting metrics |
175 | 177 | - "8125:9125/udp" |
176 | 178 |
|
177 | 179 | ### API Uploader set up |
|
193 | 195 | - name: Install dependencies for uploader |
194 | 196 | tags: uploader |
195 | 197 | apt: |
196 | | - pkg: |
| 198 | + pkg: |
197 | 199 | - python3-statsd |
198 | 200 | - python3-boto3 |
199 | 201 | - python3-clickhouse-driver |
|
203 | 205 | - name: Install uploder service |
204 | 206 | tags: uploader |
205 | 207 | template: |
206 | | - src: templates/ooni-api-uploader.service |
| 208 | + src: templates/ooni-api-uploader.service |
207 | 209 | dest: /etc/systemd/system/ooni-api-uploader.service |
208 | 210 | mode: "0644" |
209 | 211 | owner: root |
|
216 | 218 | mode: "0644" |
217 | 219 | owner: root |
218 | 220 |
|
| 221 | +- name: Create spool dir |
| 222 | + tags: uploader |
| 223 | + ansible.builtin.file: |
| 224 | + path: /var/lib/ooniapi/measurements/incoming/ |
| 225 | + state: directory |
| 226 | + mode: '0711' |
| 227 | + owner: "{{fastpath_user}}" |
| 228 | + group: "{{fastpath_user}}" |
| 229 | + |
219 | 230 | - name: Ensure uploader timer runs |
220 | 231 | tags: uploader |
221 | 232 | systemd: |
|
0 commit comments