diff options
Diffstat (limited to 'bundles/tailscale/items.py')
| -rw-r--r-- | bundles/tailscale/items.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bundles/tailscale/items.py b/bundles/tailscale/items.py new file mode 100644 index 0000000..ca0b557 --- /dev/null +++ b/bundles/tailscale/items.py @@ -0,0 +1,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 |