DEV Community

Nicholas Synovic
Nicholas Synovic

Posted on

Install Tailscale With Ansible

I recently found out about Tailscale from the Level1Tech's interview with its founder. After trying it out, I can say that I am more than satisfied with its performance, ease of use, and ability to network all of my devices together across different intranets.

As someone who prefers to configure their computer using infrastructure-as-code (IaC) practices, I decided to write an Ansible play for installing Tailscale. The following is the play that I created:

- name: Install Tailscale
  hosts: myhosts
  become: true
  tasks:
    - name: Download Tailscale GPG Key
      ansible.builtin.uri:
        dest: /usr/share/keyrings/tailscale-archive-keyring.gpg
        url: https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg 

    - name: Add Tailscale repository
      ansible.builtin.uri:
        dest: /etc/apt/sources.list.d/tailscale.list
        url: https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list

    - name: Install Tailscale
      ansible.builtin.apt:
        name: tailscale
        update_cache: true
        state: present 
Enter fullscreen mode Exit fullscreen mode

This play is my attempt at a direct translation from the Tailscale download instructions. For those who are more familiar with Ansible, let me know how I can improve upon this play.

Thanks!

Top comments (1)

Collapse
 
574n13y profile image
Vivesh

well explained !!!