Skip to content

Tailscale Operator & Ansible Tailscale deployment#658

Open
jb3 wants to merge 8 commits into
mainfrom
jb3/tailscale
Open

Tailscale Operator & Ansible Tailscale deployment#658
jb3 wants to merge 8 commits into
mainfrom
jb3/tailscale

Conversation

@jb3
Copy link
Copy Markdown
Member

@jb3 jb3 commented May 15, 2026

This PR introduces Tailscale to both Kubernetes & Ansible hosts.

On Kubernetes, the Tailscale Operator is used to allow routing traffic in/out of the cluster over Tailscale to other nodes connected to the tailnet. This allows us to securely forward traffic to an external service from any Kubernetes node without having to compromise on security.

Likewise in Ansible we now provision Tailscale on every host, optionally configuring service forwarding (where a service is allocated it's own FQDN within the tailnet) for traffic to be routed to. We can use this to secure inter-node communication on Ansible hosts or bring traffic from Kubernetes safely into Ansible with minimal overhead.

@python-discord-policy-bot python-discord-policy-bot Bot requested a review from a team May 15, 2026 00:41
@github-actions github-actions Bot added component: database An issue relating to storage of data in one of our databases (e.g. PostgreSQL, Redis, MongoDB) group: ansible Issues and pull requests related to the Ansible setup group: kubernetes Issues and pull requests related to the Kubernetes setup labels May 15, 2026
@jchristgit jchristgit self-assigned this May 20, 2026
Copy link
Copy Markdown
Contributor

@jchristgit jchristgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part.

ident_file = '/etc/postgresql/{{ postgres_version }}/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/{{ postgres_version }}-main.pid'
listen_addresses = '89.58.26.118,localhost'
listen_addresses = '89.58.26.118,lovelace.opossum-python.ts.net,localhost'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this means PostgreSQL won't start if Tailscale is not running, doesn't it?
Should we perhaps change this to * while we're at it, then? Since we already listen on our public IPv4 and rely on nftables there, we might as well, no?

Comment on lines +40 to +45
- name: Update APT cache (Debian)
ansible.builtin.apt:
update_cache: yes
when: ansible_facts["distribution"] == "Debian"
tags:
- role::tailscale
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion 1: use a handler and then - meta: flush_handlers for this
Suggestion 2: Register the task above, then add add_tailscale_apt_repository is changed to when here

- name: Update APT cache (Debian)
ansible.builtin.apt:
update_cache: yes
when: ansible_facts["distribution"] == "Debian"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could group all of these together in a block for a single condition per distribution, but I am indifferent about it.

Comment on lines +104 to +109
- name: Set tailscale_hosted_services to empty list if not defined
ansible.builtin.set_fact:
tailscale_hosted_services: []
when: not tailscale_hosted_services
tags:
- role::tailscale
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we could get the task above to return this? When would this condition hit?

- role::tailscale

- name: Ensure Tailscale services are configured
ansible.builtin.command: |-
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter is right here, we should add changed_when depending on the item standard output.

Comment on lines +54 to +55
# Allow all traffic from/to tailscale0
iifname tailscale0 accept
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is incorrect, this is the input chain. It also restates what the code speaks.

Suggested change
# Allow all traffic from/to tailscale0
iifname tailscale0 accept
# Allow all traffic from Tailscale
iifname tailscale0 accept

tailscale/tailscale-operator \
--namespace=tailscale \
--create-namespace \
--set-string oauth.clientId="<OAauth client ID>" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--set-string oauth.clientId="<OAauth client ID>" \
--set-string oauth.clientId="<OAuth client ID>" \

@github-project-automation github-project-automation Bot moved this from Up next to In Progress in Infrastructure May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: database An issue relating to storage of data in one of our databases (e.g. PostgreSQL, Redis, MongoDB) group: ansible Issues and pull requests related to the Ansible setup group: kubernetes Issues and pull requests related to the Kubernetes setup

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants