2024-07-27 09:24:00 +02:00
|
|
|
from pyinfra import host
|
2024-04-25 15:31:13 +02:00
|
|
|
from pyinfra.api import deploy
|
2024-07-27 09:24:00 +02:00
|
|
|
from pyinfra.facts.files import File
|
2024-06-08 00:53:33 +02:00
|
|
|
from pyinfra.operations import apt
|
|
|
|
from pyinfra.operations import server
|
2024-04-25 15:31:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
@deploy
|
|
|
|
def deploy_tailscale():
|
2024-07-27 09:24:00 +02:00
|
|
|
if not host.get_fact(File, "/usr/share/keyrings/tailscale-archive-keyring.gpg"):
|
|
|
|
server.shell(
|
|
|
|
name="Install tailscale signing key",
|
|
|
|
commands=[
|
|
|
|
"curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg "
|
|
|
|
"| tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null 2>&1",
|
|
|
|
],
|
|
|
|
)
|
2024-04-25 15:31:13 +02:00
|
|
|
apt.repo(
|
|
|
|
name="Add tailscale repository",
|
|
|
|
src="deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] "
|
|
|
|
"https://pkgs.tailscale.com/stable/debian bookworm main",
|
2024-06-08 00:53:33 +02:00
|
|
|
filename="tailscale",
|
2024-04-25 15:31:13 +02:00
|
|
|
)
|
|
|
|
apt.packages(
|
|
|
|
name="Install tailscale",
|
|
|
|
packages=["tailscale"],
|
2024-06-08 00:53:33 +02:00
|
|
|
update=True,
|
2024-04-25 15:31:13 +02:00
|
|
|
)
|