refactor: update authentik configuration and convert core_net dashboard template to static file
ansible-core-net / deploy (push) Successful in 25s
ansible-core-net / deploy (push) Successful in 25s
This commit is contained in:
1 parent
a243ae281c
commit
341538fba9
7 files changed
+40
-79
No files matched your search
@@ -1,12 +1,15 @@
|
||||
# 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_core.group
|
||||
id: group-admins
|
||||
identifiers:
|
||||
name: admins
|
||||
|
||||
- model: authentik_providers_proxy.proxyprovider
|
||||
id: provider-traefik-dashboard
|
||||
identifiers:
|
||||
@@ -32,11 +35,16 @@ entries:
|
||||
order: 0
|
||||
target: !KeyOf app-traefik-dashboard
|
||||
attrs:
|
||||
group: !Find [authentik_core.group, [name, admins]]
|
||||
group: !KeyOf group-admins
|
||||
|
||||
- model: authentik_outposts.outpost
|
||||
identifiers:
|
||||
name: authentik Embedded Outpost
|
||||
attrs:
|
||||
type: proxy
|
||||
service_connection: null
|
||||
config:
|
||||
authentik_host: https://auth.gunihome.ru
|
||||
providers:
|
||||
- !KeyOf provider-traefik-dashboard
|
||||
|
||||
@@ -6,15 +6,13 @@
|
||||
owner: "{{ item.owner }}"
|
||||
group: "{{ item.group }}"
|
||||
mode: "{{ item.mode }}"
|
||||
recurse: "{{ item.recurse | default(false) }}"
|
||||
loop:
|
||||
- { path: "{{ authentik_dir }}", owner: "root", group: "root", mode: "0755" }
|
||||
- { path: "{{ authentik_dir }}/db", owner: "70", group: "70", mode: "0700", recurse: true }
|
||||
- { path: "{{ authentik_dir }}/redis", owner: "999", group: "999", mode: "0700", recurse: true }
|
||||
- { path: "{{ authentik_dir }}/media", owner: "1000", group: "1000", mode: "0775", recurse: true }
|
||||
- { path: "{{ authentik_dir }}/custom-templates", owner: "1000", group: "1000", mode: "0775", recurse: true }
|
||||
- { path: "{{ authentik_dir }}/db", owner: "70", group: "70", mode: "0700" }
|
||||
- { path: "{{ authentik_dir }}/redis", owner: "999", group: "999", mode: "0700" }
|
||||
- { path: "{{ authentik_dir }}/media", owner: "1000", group: "1000", mode: "0775" }
|
||||
- { path: "{{ authentik_dir }}/custom-templates", owner: "1000", group: "1000", mode: "0775" }
|
||||
- { path: "{{ authentik_dir }}/blueprints", owner: "root", group: "root", mode: "0755" }
|
||||
register: authentik_dirs
|
||||
|
||||
- name: Проверить наличие обязательных секретов Authentik
|
||||
ansible.builtin.assert:
|
||||
@@ -32,7 +30,7 @@
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
|
||||
- name: Установить blueprint каталога пользователей Authentik
|
||||
- name: Синхронизировать blueprints Authentik
|
||||
ansible.builtin.copy:
|
||||
src: blueprints/
|
||||
dest: "{{ authentik_dir }}/blueprints/"
|
||||
@@ -46,44 +44,9 @@
|
||||
register: compose_up
|
||||
changed_when: "'Started' in compose_up.stderr or 'Created' in compose_up.stderr or 'Recreated' in compose_up.stderr or 'Pulled' in compose_up.stderr"
|
||||
|
||||
- name: Перезапустить базу и сервер Authentik при изменении прав
|
||||
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml restart authentik-db authentik-server
|
||||
when: authentik_dirs.changed
|
||||
- name: Перезапустить воркер Authentik при обновлении blueprints
|
||||
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml restart authentik-worker
|
||||
when: authentik_blueprint.changed and not compose_up.changed
|
||||
|
||||
- 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
|
||||
/blueprints/custom/traefik-dashboard.yaml
|
||||
register: authentik_blueprint_apply
|
||||
changed_when: authentik_blueprint.changed
|
||||
retries: 18
|
||||
delay: 10
|
||||
until: authentik_blueprint_apply.rc == 0
|
||||
|
||||
- name: Обновить права сервисного аккаунта встроенного outpost
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- docker
|
||||
- compose
|
||||
- -f
|
||||
- "{{ authentik_dir }}/compose.yaml"
|
||||
- exec
|
||||
- -T
|
||||
- authentik-worker
|
||||
- ak
|
||||
- shell
|
||||
- -c
|
||||
- >-
|
||||
from authentik.outposts.models import Outpost;
|
||||
from authentik.outposts.tasks import _outpost_single_update;
|
||||
outpost = Outpost.objects.get(name="authentik Embedded Outpost");
|
||||
_outpost_single_update(outpost)
|
||||
register: authentik_outpost_perms
|
||||
changed_when: true
|
||||
retries: 6
|
||||
delay: 5
|
||||
until: authentik_outpost_perms.rc == 0
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ services:
|
||||
AUTHENTIK_POSTGRESQL__NAME: authentik
|
||||
AUTHENTIK_POSTGRESQL__PASSWORD: {{ authentik_postgres_password }}
|
||||
AUTHENTIK_SECRET_KEY: {{ authentik_secret_key }}
|
||||
AUTHENTIK_DISABLE_UPDATE_CHECK: "true"
|
||||
AUTHENTIK_DISABLE_STARTUP_ANALYTICS: "true"
|
||||
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
|
||||
AUTHENTIK_OUTPOSTS__DISCOVER: "false"
|
||||
volumes:
|
||||
- {{ authentik_dir }}/media:/media
|
||||
- {{ authentik_dir }}/custom-templates:/templates
|
||||
@@ -69,9 +73,11 @@ services:
|
||||
AUTHENTIK_POSTGRESQL__NAME: authentik
|
||||
AUTHENTIK_POSTGRESQL__PASSWORD: {{ authentik_postgres_password }}
|
||||
AUTHENTIK_SECRET_KEY: {{ authentik_secret_key }}
|
||||
user: root
|
||||
AUTHENTIK_DISABLE_UPDATE_CHECK: "true"
|
||||
AUTHENTIK_DISABLE_STARTUP_ANALYTICS: "true"
|
||||
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
|
||||
AUTHENTIK_OUTPOSTS__DISCOVER: "false"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- {{ authentik_dir }}/media:/media
|
||||
- {{ authentik_dir }}/custom-templates:/templates
|
||||
- {{ authentik_dir }}/blueprints:/blueprints/custom:ro
|
||||
|
||||
Reference in new issue
Block a user