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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
- name: Update system things
hosts: mountain-of-faith
become: true
tasks:
- name: Remove big packages
ansible.builtin.apt:
name: "{{ item }}"
state: absent
update_cache: true
autoremove: true
loop:
- chromium
- name: Install things
ansible.builtin.apt:
name: "{{ item }}"
state: present
update_cache: true
loop:
- neovim
- name: Update all packages to their latest version
ansible.builtin.apt:
name: "*"
state: latest
update_cache: true
autoremove: true
- name: Upgrade the OS (apt-get dist-upgrade)
ansible.builtin.apt:
upgrade: dist
# What a pain in the ass - useful things for debugging:
#
# - https://tailscale.com/blog/sisyphean-dns-client-linux
# - https://wiki.archlinux.org/title/Systemd-resolved
# - resolvectl status
# - resolvectl query DOMAIN_NAME
- name: Configure systemd-resolved
tags: resolved
hosts: mountain-of-faith
become: true
tasks:
- name: Configure systemd-resolved
ansible.builtin.copy:
dest: /etc/systemd/resolved.conf
content: |
[Resolve]
# tailscale
DNS=100.100.100.100
Domains={{ tailscale.tailnet_name }}.ts.net
# pihole
DNSStubListener=no
mode: "0644"
notify: restart systemd-resolved
- name: Enable and start systemd-resolved
ansible.builtin.systemd:
name: systemd-resolved
enabled: true
state: started
handlers:
- name: restart systemd-resolved
ansible.builtin.systemd:
name: systemd-resolved
state: restarted
- import_playbook: ../playbooks/tailscale.yml
- import_playbook: ../playbooks/docker.yml
- name: Mount USB drive
hosts: mountain-of-faith
become: true
tasks:
# Use `lsblk -f` to find the UUID
- name: Mount the USB drive to /mnt/mountain-of-faith
ansible.posix.mount:
path: /mnt/mountain-of-faith
src: UUID=337a82a2-0046-4cbf-93f3-8fc978c3e944
fstype: ext4
opts: defaults,nofail
state: mounted
- name: Set up Restic
tags: restic
hosts: mountain-of-faith
become: true
tasks:
- name: Create Restic user
ansible.builtin.user:
name: restic
system: true
# '*' rather than Debian's default locked '!': sshd under UsePAM no
# refuses locked users, and this play should match lolk's.
password: "*"
state: present
- name: Add SSH key for restic user
ansible.posix.authorized_key:
user: restic
key: "{{ item }}"
loop:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILrlVay1GlpCuhYSUup/K/gRYmltycViPBAdZ8t9OKtu # lotus-land-story
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPgX0tA28NO3djYaV++JxggR0t47xou+R0HQVwVjzj8s # 1password
- name: Create Restic directory
ansible.builtin.file:
path: /mnt/mountain-of-faith/restic
state: directory
owner: restic
group: restic
mode: "0755"
- name: Create Docker network
hosts: mountain-of-faith
become: true
tasks:
- name: Create IPv6 Docker network
community.docker.docker_network:
name: mountain-of-faith
enable_ipv6: true
state: present
- name: Run Pi-Hole
tags: pihole
hosts: mountain-of-faith
vars:
version: 2025.11.1
tasks:
- name: Run the Pi-Hole container
become: true
community.docker.docker_container:
name: pihole
image: pihole/pihole:{{ version }}
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:80/tcp"
# - "443:443/tcp"
# - "67:67/udp" # DHCP
# - "123:123/udp" # NTP
networks:
- name: mountain-of-faith
env:
TZ: "America/Los_Angeles"
FTLCONF_webserver_api_password: "{{ pihole.password }}"
FTLCONF_dns_listeningMode: "all"
FTLCONF_dns_upstreams: "1.1.1.1;1.0.0.1;2606:4700:4700::1111;2606:4700:4700::1001" # cloudflare
volumes:
- "./etc-pihole:/etc/pihole"
capabilities:
- NET_ADMIN
- SYS_TIME
- SYS_NICE
restart_policy: unless-stopped
state: started
no_log: true
# TODO Remove Minio
- import_playbook: minio.yml
- import_playbook: ../playbooks/syncthing.yml
- name: Set up metrics
tags: metrics
hosts: mountain-of-faith
become: true
tasks:
- name: Install blackbox-exporter
ansible.builtin.apt:
name: "{{ item }}"
state: present
loop:
- prometheus-blackbox-exporter
- prometheus-node-exporter
- name: Create Blackbox config directory
ansible.builtin.file:
path: /mnt/mountain-of-faith/blackbox-exporter
state: directory
mode: "0755"
- name: Create Blackbox configuration file
ansible.builtin.copy:
dest: /mnt/mountain-of-faith/blackbox-exporter/blackbox.yml
content: |
modules:
dns:
prober: dns
dns:
preferred_ip_protocol: ip4
query_name: kejadlen.dev
query_type: A # https://blog.cloudflare.com/rfc8482-saying-goodbye-to-any/
dns_ipv6:
prober: dns
dns:
query_name: kejadlen.dev
query_type: A # https://blog.cloudflare.com/rfc8482-saying-goodbye-to-any/
http:
prober: http
http:
preferred_ip_protocol: ip4
http_internal:
prober: http
http:
preferred_ip_protocol: ip4
tls_config:
# TODO use ca_file instead
insecure_skip_verify: true
http_ipv6:
prober: http
icmp:
prober: icmp
timeout: 5s
icmp:
preferred_ip_protocol: "ip4"
mode: "0644"
notify: restart blackbox-exporter
- name: Configure blackbox-exporter service
ansible.builtin.lineinfile:
path: /etc/default/prometheus-blackbox-exporter
regexp: '^ARGS='
line: 'ARGS="--config.file=/mnt/mountain-of-faith/blackbox-exporter/blackbox.yml"'
notify: restart blackbox-exporter
# Not sure if this actually works, but can alternatively use
# `dpkg-reconfigure prometheus-blackbox-exporter`
- name: Enable ICMP capabilities for blackbox-exporter
ansible.builtin.command: setcap cap_net_raw+ep /usr/bin/prometheus-blackbox-exporter
changed_when: false
notify: restart blackbox-exporter
handlers:
- name: restart blackbox-exporter
ansible.builtin.systemd:
name: prometheus-blackbox-exporter
state: restarted
- name: Run Prusa Exporter
tags: prusa-exporter
hosts: mountain-of-faith
become: true
vars:
version: 2.0.0-rc1
tasks:
- name: Create Prusa Exporter config directory
ansible.builtin.file:
path: /mnt/mountain-of-faith/prusa-exporter
state: directory
mode: "0755"
- name: Create Prusa Exporter configuration file
ansible.builtin.template:
src: templates/prusa.yml
dest: /mnt/mountain-of-faith/prusa-exporter/prusa.yml
mode: "0644"
vars:
# can we get this dynamically?
address: 192.168.40.60
notify: restart prusa-exporter
- name: Run the Prusa Exporter container
community.docker.docker_container:
name: prusa-exporter
image: pubeldev/prusa_exporter:{{ version }}
ports:
- "10009:10009/tcp"
- "8514:8514/udp"
volumes:
- "/mnt/mountain-of-faith/prusa-exporter/prusa.yml:/app/prusa.yml:ro"
command:
- "--config.file=/app/prusa.yml"
- "--log.level=info"
- "--prusalink.scrape-timeout=5"
- "--udp.ip-override={{ host_ip }}"
- "--udp.gcode-enabled"
# TODO?
# - "--loki.push-url=http://localhost:9428/insert/loki/api/v1/push"
restart_policy: unless-stopped
state: started
vars:
host_ip: "{{ ansible_facts.default_ipv4.address }}"
handlers:
- name: restart prusa-exporter
community.docker.docker_container:
name: prusa-exporter
state: started
restart: true
- import_playbook: ups.yml
# vim: ft=yaml.ansible