netbird server works now. linted the yml files
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
---
|
||||
caddy_container: caddy
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
netbird_domain: netbird.tanshu.com
|
||||
netbird_mgmt_api_port: 33073
|
||||
netbird_signal_port: 10000
|
||||
netbird_coturn_port: 3478
|
||||
# Note: As of NetBird v0.62+, it includes an integrated local Identity Provider!
|
||||
# You no longer need an external IdP like Authentik, Zitadel, or Auth0 to get started.
|
||||
# You can set up your first admin account directly in the NetBird Dashboard UI.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
- name: Create Netbird docker network
|
||||
community.docker.docker_network:
|
||||
name: netbird_net
|
||||
state: present
|
||||
|
||||
- name: Create Netbird configuration directories
|
||||
ansible.builtin.file:
|
||||
path: "/var/lib/netbird/{{ item }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
loop:
|
||||
- server/etc
|
||||
- server/data
|
||||
|
||||
- name: Deploy Netbird server configuration
|
||||
ansible.builtin.template:
|
||||
src: config.yaml.j2
|
||||
dest: /var/lib/netbird/server/etc/config.yaml
|
||||
mode: "0644"
|
||||
force: false
|
||||
|
||||
- name: Start Netbird Server Container
|
||||
community.docker.docker_container:
|
||||
name: netbird-server
|
||||
image: netbirdio/netbird-server:latest
|
||||
state: started
|
||||
restart_policy: always
|
||||
network_mode: netbird_net
|
||||
ports:
|
||||
- "{{ netbird_mgmt_api_port }}:80/tcp"
|
||||
volumes:
|
||||
- "/var/lib/netbird/server/etc:/etc/netbird"
|
||||
- "/var/lib/netbird/server/data:/var/lib/netbird"
|
||||
command: "--config /etc/netbird/config.yaml"
|
||||
|
||||
- name: Start Netbird Dashboard Container
|
||||
community.docker.docker_container:
|
||||
name: netbird-dashboard
|
||||
image: netbirdio/dashboard:latest
|
||||
state: started
|
||||
restart_policy: always
|
||||
network_mode: netbird_net
|
||||
env:
|
||||
NETBIRD_MGMT_API_ENDPOINT: "https://{{ netbird_domain }}"
|
||||
NETBIRD_MGMT_GRPC_API_ENDPOINT: "https://{{ netbird_domain }}"
|
||||
AUTH_AUDIENCE: "netbird-dashboard"
|
||||
AUTH_CLIENT_ID: "netbird-dashboard"
|
||||
AUTH_CLIENT_SECRET: ""
|
||||
AUTH_AUTHORITY: "https://{{ netbird_domain }}/oauth2"
|
||||
USE_AUTH0: "false"
|
||||
AUTH_SUPPORTED_SCOPES: "openid profile email groups"
|
||||
AUTH_REDIRECT_URI: "/nb-auth"
|
||||
AUTH_SILENT_REDIRECT_URI: "/nb-silent-auth"
|
||||
@@ -0,0 +1,33 @@
|
||||
# Combined NetBird Server Configuration
|
||||
# Generated by Ansible
|
||||
|
||||
server:
|
||||
listenAddress: ":80"
|
||||
exposedAddress: "https://{{ netbird_domain }}:443"
|
||||
stunPorts:
|
||||
- 3478
|
||||
metricsPort: 9090
|
||||
healthcheckAddress: ":9000"
|
||||
logLevel: "info"
|
||||
logFile: "console"
|
||||
|
||||
authSecret: "{{ netbird_relay_secret }}"
|
||||
dataDir: "/var/lib/netbird"
|
||||
|
||||
auth:
|
||||
issuer: "https://{{ netbird_domain }}/oauth2"
|
||||
signKeyRefreshEnabled: true
|
||||
sessionCookieEncryptionKey: "{{ lookup('password', '/dev/null chars=ascii_letters,digits length=32') | b64encode }}"
|
||||
dashboardRedirectURIs:
|
||||
- "https://{{ netbird_domain }}/nb-auth"
|
||||
- "https://{{ netbird_domain }}/nb-silent-auth"
|
||||
cliRedirectURIs:
|
||||
- "http://localhost:53000/"
|
||||
|
||||
reverseProxy:
|
||||
trustedHTTPProxies:
|
||||
- "0.0.0.0/0"
|
||||
|
||||
store:
|
||||
engine: "sqlite"
|
||||
encryptionKey: "{{ netbird_datastore_enc_key }}"
|
||||
Reference in New Issue
Block a user