diff options
| author | Robert Günzler <r@gnzler.io> | 2025-09-07 17:32:13 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2025-09-07 17:42:42 +0200 |
| commit | 38be6c13f76e893cf47636257071b440dec0c5b2 (patch) | |
| tree | f7ded3235a7e3362cbd1ed3d91523968fe0faf90 /bundles/tailscale | |
initial commit
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bundles/tailscale')
| -rw-r--r-- | bundles/tailscale/items.py | 39 | ||||
| -rw-r--r-- | bundles/tailscale/metadata.py | 7 |
2 files changed, 46 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 diff --git a/bundles/tailscale/metadata.py b/bundles/tailscale/metadata.py new file mode 100644 index 0000000..71fb834 --- /dev/null +++ b/bundles/tailscale/metadata.py @@ -0,0 +1,7 @@ +defaults = { + "apk": { + "packages": { + "tailscale": {}, + }, + }, +} |