28 lines
941 B
Python
28 lines
941 B
Python
from pyinfra import host
|
|
from pyinfra.api import deploy
|
|
from pyinfra.facts.files import File
|
|
from pyinfra.operations import apt
|
|
from pyinfra.operations import server
|
|
|
|
|
|
@deploy
|
|
def deploy_tailscale():
|
|
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",
|
|
],
|
|
)
|
|
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",
|
|
filename="tailscale",
|
|
)
|
|
apt.packages(
|
|
name="Install tailscale",
|
|
packages=["tailscale"],
|
|
update=True,
|
|
)
|