netbird server works now. linted the yml files

This commit is contained in:
2026-08-30 07:35:08 +00:00
parent ae69c2fafe
commit 35a3bb9ad2
40 changed files with 366 additions and 135 deletions
+2
View File
@@ -0,0 +1,2 @@
---
caddy_container: caddy
+9
View File
@@ -0,0 +1,9 @@
{{ netbird_domain }} {
@grpc header Content-Type application/grpc*
reverse_proxy @grpc h2c://netbird-server:80
@backend path /relay* /ws-proxy/* /api/* /oauth2/*
reverse_proxy @backend netbird-server:80
reverse_proxy /* netbird-dashboard:80
}
+5
View File
@@ -0,0 +1,5 @@
---
- name: Reload Caddy configuration
ansible.builtin.command: "docker exec -w /etc/caddy {{ caddy_container }} caddy reload"
listen: "Reload Caddy"
changed_when: true
+36
View File
@@ -0,0 +1,36 @@
---
- name: Ensure 'caddy' container is connected to netbird_net
community.docker.docker_network:
name: netbird_net
state: present
connected:
- caddy
appends: true
- name: Read current Caddyfile
ansible.builtin.slurp:
path: "/var/lib/caddy/conf/Caddyfile"
register: caddy_caddyfile_raw
ignore_errors: true
- name: Decode Caddyfile content
ansible.builtin.set_fact:
caddy_caddyfile_content: "{{ caddy_caddyfile_raw['content'] | b64decode }}"
- name: Read snippet from template file
ansible.builtin.set_fact:
caddy_netbird_caddy_snippet: "{{ lookup('template', 'files/Caddyfile.j2') }}"
- name: Check if Netbird snippet already exists
ansible.builtin.set_fact:
caddy_snippet_present: "{{ caddy_netbird_caddy_snippet in caddy_caddyfile_content }}"
- name: Add Netbird snippet to Caddyfile
ansible.builtin.blockinfile:
path: "/var/lib/caddy/conf/Caddyfile"
marker: "# {mark} Ansible managed Caddy snippet for Netbird"
block: "{{ caddy_netbird_caddy_snippet }}"
create: true
mode: "0644"
when: not caddy_snippet_present
notify: Reload Caddy