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
|
if node.os != "alpine":
raise BundleError(f"{node.name}: OS {node.os} is not supported.")
svc_openrc = {
"tailscale": {
"enabled": True,
"running": True,
"needs": [
"pkg_apk:tailscale",
],
},
}
tailscale_authkey = node.metadata.get("tailscale/authkey", None)
if not tailscale_authkey:
raise KeyError
actions = {
"tailscale_up": {
"command": f"tailscale up --authkey={tailscale_authkey}",
"needs": [
"pkg_apk:tailscale",
"svc_openrc:tailscale",
],
"unless": "tailscale ip -1 >/dev/null 2>&1",
},
"tailscale_advertise_exit_node": {
"command": "tailscale set --advertise-exit-node",
"interactive": False, # doesn't hurt to run every time
"needs": [
"pkg_apk:tailscale",
"svc_openrc:tailscale",
# "action:tailscale_up", ?
],
},
}
# TODO: metrics https://forum.tailscale.com/t/monitor-tailscale-by-prometheus/2315
|