From 20f936327f0df3955e050eb6e30127caf7eddef6 Mon Sep 17 00:00:00 2001 From: Artis3n Date: Sun, 4 Jul 2021 13:55:46 -0400 Subject: [PATCH] feat: Install latest Tailscale version by default --- .ansible-lint | 1 + README.md | 17 ++++++++++++++--- defaults/main.yml | 6 +++--- tasks/arch.yml | 9 --------- tasks/centos.yml | 9 --------- tasks/debian.yml | 9 --------- tasks/fedora.yml | 8 -------- tasks/main.yml | 4 ++-- vars/main.yml | 9 ++++++++- 9 files changed, 28 insertions(+), 44 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index c4267d63..4541b420 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,3 +7,4 @@ exclude_paths: skip_list: - line-length + - package-latest diff --git a/README.md b/README.md index a38a0228..e5f9d901 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,20 @@ [![GitHub followers](https://img.shields.io/github/followers/artis3n?style=social)](https://github.com/artis3n/) [![Twitter Follow](https://img.shields.io/twitter/follow/artis3n?style=social)](https://twitter.com/Artis3n) -This role initializes a [Tailscale][] node. - -Find supported operating systems on this role's [Ansible Galaxy page](https://galaxy.ansible.com/artis3n/tailscale). +This role initializes a [Tailscale][] node. If Tailscale is already installed, this role will update Tailscale to the latest version. +This role does not re-apply the `up` command if Tailscale is already logged in. This will be supported in a [future release](https://github.com/artis3n/ansible-role-tailscale/issues/115). + +Supported operating systems: +- Debian +- Ubuntu +- CentOS / RedHat +- Amazon Linux +- Oracle Linux +- Fedora +- Arch Linux +- Raspbian (untested but should work) + +See the [CI worfklow](https://github.com/artis3n/ansible-role-tailscale/blob/main/.github/workflows/ci.yml#L15) for the list of distribution versions actively tested in each pull request. ## Requirements diff --git a/defaults/main.yml b/defaults/main.yml index 5d3009f4..fa22f28b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,6 @@ +--- +# Variables that an end user should likely never modify. + debian_family_distros: - Ubuntu - Debian @@ -11,9 +14,6 @@ centos_family_distros: tailscale_package: tailscale tailscale_service: tailscaled -release_stability: stable -upgrade_release: false - repo_description: Tailscale repository apt_dependencies: diff --git a/tasks/arch.yml b/tasks/arch.yml index 05b52b1c..53e011de 100644 --- a/tasks/arch.yml +++ b/tasks/arch.yml @@ -1,17 +1,8 @@ --- - name: Arch | Install Tailscale - become: true - pacman: - name: '{{ tailscale_package }}' - update_cache: true - state: present - when: not upgrade_release | bool - -- name: Arch | Install or upgrade Tailscale become: true pacman: name: '{{ tailscale_package }}' update_cache: true state: latest - when: upgrade_release | bool diff --git a/tasks/centos.yml b/tasks/centos.yml index 6b17cb94..f0abaa03 100644 --- a/tasks/centos.yml +++ b/tasks/centos.yml @@ -12,17 +12,8 @@ creates: /etc/yum.repos.d/tailscale.repo - name: CentOS | Install Tailscale - become: true - yum: - name: "{{ tailscale_package }}" - disable_gpg_check: true - state: present - when: not upgrade_release | bool - -- name: CentOS | Install or upgrade Tailscale become: true yum: name: "{{ tailscale_package }}" disable_gpg_check: true state: latest - when: upgrade_release | bool diff --git a/tasks/debian.yml b/tasks/debian.yml index f91f8acc..5bac1c91 100644 --- a/tasks/debian.yml +++ b/tasks/debian.yml @@ -29,17 +29,8 @@ state: present - name: Debian | Install Tailscale - become: true - apt: - name: "{{ tailscale_package }}" - state: present - update_cache: true - when: not upgrade_release | bool - -- name: Debian | Install or upgrade Tailscale become: true apt: name: "{{ tailscale_package }}" state: latest update_cache: true - when: upgrade_release | bool diff --git a/tasks/fedora.yml b/tasks/fedora.yml index 25f3e0d9..8120842b 100644 --- a/tasks/fedora.yml +++ b/tasks/fedora.yml @@ -33,15 +33,7 @@ warn: false - name: Fedora | Install Tailscale - become: true - dnf: - name: "{{ tailscale_package }}" - state: present - when: not upgrade_release | bool - -- name: Fedora | Install or upgrade Tailscale become: true dnf: name: "{{ tailscale_package }}" state: latest - when: upgrade_release | bool diff --git a/tasks/main.yml b/tasks/main.yml index 5c8a62af..ee36970b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,12 +5,12 @@ You must include a Node Authorization auth key. Set a `tailscale_auth_key` ansible-vault encrypted variable. You can create this key from: https://login.tailscale.com/admin/authkeys. - when: tailscale_auth_key is not defined and not tailscale_up_skip|bool + when: tailscale_auth_key == None and not tailscale_up_skip | bool - name: Skipping Authentication debug: msg: You have set 'tailscale_up_skip', so this node will not authenticate to your Tailscale network. - when: tailscale_up_skip|bool + when: tailscale_up_skip | bool - name: Unstable Warning # Print an error message to the console but proceed anyway diff --git a/vars/main.yml b/vars/main.yml index 3647187d..6410edfa 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,9 +1,16 @@ --- -# vars file for artis3n.tailscale +# Variables that a user may want to modify. +# Required Node auth key to authenticate to Tailscale +tailscale_auth_key: null +# Optional command-line arguments for 'tailscale up' +tailscale_args: null # Whether to output debug information during role execution verbose: false # Whether to skip 'tailscale up' tailscale_up_skip: false # Whether to always run 'tailscale up' force: false +# Whether to use the stable or unstable upstream Tailscale build. +# Strongly recommend to leave on 'stable' unless you know what you're doing +release_stability: stable