feat(authentik): integrate Traefik dashboard with Authentik for admin access control and streamline secret management
ansible-core-net / deploy (push) Successful in 33s
ansible-core-net / deploy (push) Successful in 33s
This commit is contained in:
1 parent
3a8ef2579b
commit
340964523e
8 files changed
+62
-34
No files matched your search
@@ -5,3 +5,11 @@
|
||||
roles:
|
||||
- core_net
|
||||
- authentik
|
||||
tasks:
|
||||
- name: Закрыть панель Traefik через Authentik
|
||||
ansible.builtin.template:
|
||||
src: "{{ playbook_dir }}/../roles/core_net/templates/dynamic/dashboard.yml.j2"
|
||||
dest: "{{ traefik_dynamic_dir }}/dashboard.yml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
@@ -0,0 +1,42 @@
|
||||
# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
|
||||
# Панель Traefik. Список providers у встроенного outpost полный:
|
||||
# следующий proxy-провайдер добавляется сюда же.
|
||||
version: 1
|
||||
metadata:
|
||||
name: traefik-dashboard
|
||||
labels:
|
||||
blueprints.goauthentik.io/description: "Панель Traefik только для группы admins"
|
||||
entries:
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
id: provider-traefik-dashboard
|
||||
identifiers:
|
||||
name: traefik-dashboard
|
||||
attrs:
|
||||
mode: forward_single
|
||||
external_host: https://proxy.gunihome.ru
|
||||
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
|
||||
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
|
||||
|
||||
- model: authentik_core.application
|
||||
id: app-traefik-dashboard
|
||||
identifiers:
|
||||
slug: traefik-dashboard
|
||||
attrs:
|
||||
name: Traefik
|
||||
meta_launch_url: https://proxy.gunihome.ru
|
||||
policy_engine_mode: any
|
||||
provider: !KeyOf provider-traefik-dashboard
|
||||
|
||||
- model: authentik_policies.policybinding
|
||||
identifiers:
|
||||
order: 0
|
||||
target: !KeyOf app-traefik-dashboard
|
||||
attrs:
|
||||
group: !Find [authentik_core.group, [name, admins]]
|
||||
|
||||
- model: authentik_outposts.outpost
|
||||
identifiers:
|
||||
name: authentik Embedded Outpost
|
||||
attrs:
|
||||
providers:
|
||||
- !KeyOf provider-traefik-dashboard
|
||||
@@ -53,7 +53,9 @@
|
||||
- name: Применить blueprint каталога пользователей Authentik
|
||||
ansible.builtin.command: >-
|
||||
docker compose -f {{ authentik_dir }}/compose.yaml exec -T authentik-worker
|
||||
ak apply_blueprint /blueprints/custom/homelab-directory.yaml
|
||||
ak apply_blueprint
|
||||
/blueprints/custom/homelab-directory.yaml
|
||||
/blueprints/custom/traefik-dashboard.yaml
|
||||
register: authentik_blueprint_apply
|
||||
changed_when: authentik_blueprint.changed
|
||||
retries: 18
|
||||
|
||||
@@ -4,4 +4,3 @@ traefik_dir: "/opt/traefik"
|
||||
traefik_dynamic_dir: "/opt/traefik/dynamic"
|
||||
traefik_log_dir: "/var/log/traefik"
|
||||
traefik_acme_email: "vvkarpenok@gmail.com"
|
||||
traefik_dashboard_auth: "{{ lookup('env', 'TRAEFIK_DASHBOARD_AUTH') }}"
|
||||
@@ -60,12 +60,6 @@
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Проверить наличие обязательных секретов Traefik
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- traefik_dashboard_auth is defined and traefik_dashboard_auth | length > 0
|
||||
fail_msg: "Переменная TRAEFIK_DASHBOARD_AUTH не передана из Infisical!"
|
||||
|
||||
- name: Синхронизировать динамические конфигурации маршрутов
|
||||
ansible.builtin.copy:
|
||||
src: dynamic/
|
||||
@@ -74,14 +68,6 @@
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Установить конфигурацию Traefik dashboard
|
||||
ansible.builtin.template:
|
||||
src: dynamic/dashboard.yml.j2
|
||||
dest: "{{ traefik_dynamic_dir }}/dashboard.yml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Найти существующие файлы маршрутов на сервере
|
||||
ansible.builtin.find:
|
||||
paths: "{{ traefik_dynamic_dir }}"
|
||||
|
||||
@@ -6,12 +6,6 @@ http:
|
||||
- websecure
|
||||
service: api@internal
|
||||
middlewares:
|
||||
- dashboard-auth
|
||||
- authentik@file
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
|
||||
middlewares:
|
||||
dashboard-auth:
|
||||
basicAuth:
|
||||
users:
|
||||
- "{{ traefik_dashboard_auth }}"
|
||||
Reference in new issue
Block a user