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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# https://tailscale.com/download/linux/debian
- name: Install Tailscale
hosts: ramble-hard
become: true
tasks:
- name: Assert distribution is Debian
ansible.builtin.assert:
that:
- ansible_facts["distribution"] == "Debian"
fail_msg: "This playbook only supports Debian distributions"
# ansible.builtin.deb822_repository needs python-debian on the target.
- name: Install required packages
ansible.builtin.apt:
name: python3-debian
state: present
update_cache: true
# curl -fsSL https://pkgs.tailscale.com/stable/debian/$(. /etc/os-release && echo "$VERSION_CODENAME").noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
- name: Download Tailscale package signing key
ansible.builtin.get_url:
url: https://pkgs.tailscale.com/stable/debian/{{ ansible_facts["distribution_release"] }}.noarmor.gpg
dest: /usr/share/keyrings/tailscale-archive-keyring.gpg
mode: "0644"
# Left behind by ansible.builtin.apt_repository; apt reads both formats, so
# leaving them would configure the repository twice. Older runs didn't set
# a filename, so match on the URI rather than tailscale.list.
- name: Find one-line Tailscale repositories
ansible.builtin.find:
paths: /etc/apt/sources.list.d
patterns: "*.list"
contains: pkgs\.tailscale\.com
read_whole_file: true
register: tailscale_list_sources
- name: Remove one-line Tailscale repositories
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ tailscale_list_sources.files }}"
loop_control:
label: "{{ item.path }}"
# curl -fsSL https://pkgs.tailscale.com/stable/debian/$(. /etc/os-release && echo "$VERSION_CODENAME").tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
- name: Add Tailscale repository
ansible.builtin.deb822_repository:
name: tailscale
types: deb
uris: https://pkgs.tailscale.com/stable/debian
suites: '{{ ansible_facts["distribution_release"] }}'
components: main
signed_by: /usr/share/keyrings/tailscale-archive-keyring.gpg
state: present
# sudo apt-get update
# sudo apt-get install tailscale
- name: Install Tailscale
ansible.builtin.apt:
name: tailscale
state: present
update_cache: true