-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtailscale-ubuntu.tftpl
33 lines (23 loc) · 1.02 KB
/
tailscale-ubuntu.tftpl
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
#!/bin/bash
#
# Installs tailscale, runs `tailscale up`, and runs additional scripts if provided
#
exec > >(tee /var/log/tailscale-user-data.log|logger -t tailscale-user-data -s 2>/dev/console) 2>&1
%{ for s in before_scripts }
${s}
%{ endfor }
echo -e '\n#\n# Beginning Tailscale installation...\n#\n'
# https://tailscale.com/kb/1187/install-ubuntu-2204/
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
apt-get -qq update
apt-get install -yqq tailscale
tailscale up ${join(" ", tailscale_arguments)}
%{ for s in tailscale_set_preferences }
tailscale set ${s}
%{ endfor }
echo -e '\n#\n# Complete.\n#\n'
%{ for s in after_scripts }
${s}
%{ endfor }
tailscale status --peers=false 2>&1 1> /dev/null && echo -e '\n#\n# Tailscale status: connected\n#\n' || echo -e '\n#\n# Tailscale status: NOT connected\n#\n'