From 6d200058060e1831d2ddf7e6046b65b7dba539dc Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sat, 8 Apr 2023 20:21:38 -0700 Subject: [PATCH] tailscale --- lotus-land-story/README.md | 5 +++++ lotus-land-story/main.tf | 2 +- lotus-land-story/main.yml | 10 ++++++++-- playbooks/tailscale.yml | 29 +++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 playbooks/tailscale.yml diff --git a/lotus-land-story/README.md b/lotus-land-story/README.md index 080a00c..83d7987 100644 --- a/lotus-land-story/README.md +++ b/lotus-land-story/README.md @@ -14,4 +14,9 @@ ansible all -m ping # ansible rake ansible + +# manually connect to tailscale + +# specific playbooks +rake ansible[playbook] ``` diff --git a/lotus-land-story/main.tf b/lotus-land-story/main.tf index 6efaeb0..dffba23 100644 --- a/lotus-land-story/main.tf +++ b/lotus-land-story/main.tf @@ -59,7 +59,7 @@ resource "linode_domain_record" "subdomains" { target = resource.linode_instance.lotus_land_story.ip_address for_each = toset(["rss", "prometheus", "grafana", "loki"]) - name = each.key + name = each.key } resource "linode_domain_record" "prometheus" { diff --git a/lotus-land-story/main.yml b/lotus-land-story/main.yml index a8aa556..a10e98b 100644 --- a/lotus-land-story/main.yml +++ b/lotus-land-story/main.yml @@ -3,12 +3,17 @@ vars_files: - vars.yml tasks: + - name: Always mount the lotus-land-story volume ansible.builtin.lineinfile: dest: /etc/fstab line: "{{ linode_volume }} /mnt/lotus-land-story ext4 defaults,noatime,nofail 0 2" state: present + - name: Set hostname + ansible.builtin.hostname: + name: lotus-land-story + - name: Install ansible requirements ansible.builtin.apt: pkg: @@ -18,8 +23,9 @@ - python3-psycopg2 state: present -- import_playbook: postgres.yml # noqa: name[play] -- import_playbook: docker.yml # noqa: name[play] +- import_playbook: ../playbooks/tailscale.yml # noqa: name[play] +- import_playbook: postgres.yml # noqa: name[play] +- import_playbook: docker.yml # noqa: name[play] - name: Set up postgres hosts: lotus-land-story diff --git a/playbooks/tailscale.yml b/playbooks/tailscale.yml new file mode 100644 index 0000000..0fe69bb --- /dev/null +++ b/playbooks/tailscale.yml @@ -0,0 +1,29 @@ +# https://tailscale.com/download/linux/debian-bullseye + +- name: Install Tailscale + hosts: all + become: true + tasks: + + # curl -fsSL https://pkgs.tailscale.com/stable/debian/bullseye.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/bullseye.noarmor.gpg + dest: /usr/share/keyrings/tailscale-archive-keyring.gpg + + # curl -fsSL https://pkgs.tailscale.com/stable/debian/bullseye.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list + - name: Add Tailscale repository + ansible.builtin.apt_repository: + repo: deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/debian bullseye main + state: present + + # sudo apt-get update + - name: Update apt-get + ansible.builtin.apt: + update_cache: true + + # sudo apt-get install tailscale + - name: Install Tailscale + ansible.builtin.package: + name: tailscale + state: present