feat(authentik): add blueprint directory setup and apply functionality
ansible-core-net / deploy (push) Successful in 35s
ansible-core-net / deploy (push) Successful in 35s
This commit is contained in:
1 parent
f0f3b61407
commit
3a8ef2579b
3 files changed
+61
No files matched your search
@@ -0,0 +1,39 @@
|
|||||||
|
# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
|
||||||
|
# Каталог пользователей. Пароли не задаются: их выставляет суперадмин в интерфейсе.
|
||||||
|
version: 1
|
||||||
|
metadata:
|
||||||
|
name: homelab-directory
|
||||||
|
labels:
|
||||||
|
blueprints.goauthentik.io/description: "Группы admins и family"
|
||||||
|
entries:
|
||||||
|
- model: authentik_core.group
|
||||||
|
id: admins
|
||||||
|
identifiers:
|
||||||
|
name: admins
|
||||||
|
|
||||||
|
- model: authentik_core.group
|
||||||
|
id: family
|
||||||
|
identifiers:
|
||||||
|
name: family
|
||||||
|
|
||||||
|
- model: authentik_core.user
|
||||||
|
identifiers:
|
||||||
|
username: karpenok
|
||||||
|
attrs:
|
||||||
|
name: karpenok
|
||||||
|
is_active: true
|
||||||
|
is_superuser: true
|
||||||
|
groups:
|
||||||
|
- !Find [authentik_core.group, [name, "authentik Admins"]]
|
||||||
|
- !KeyOf admins
|
||||||
|
- !KeyOf family
|
||||||
|
|
||||||
|
- model: authentik_core.user
|
||||||
|
identifiers:
|
||||||
|
username: ksynia
|
||||||
|
attrs:
|
||||||
|
name: ksynia
|
||||||
|
is_active: true
|
||||||
|
is_superuser: false
|
||||||
|
groups:
|
||||||
|
- !KeyOf family
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
- { path: "{{ authentik_dir }}/redis", owner: "999", group: "999", 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 }}/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 }}/custom-templates", owner: "1000", group: "1000", mode: "0775", recurse: true }
|
||||||
|
- { path: "{{ authentik_dir }}/blueprints", owner: "root", group: "root", mode: "0755" }
|
||||||
register: authentik_dirs
|
register: authentik_dirs
|
||||||
|
|
||||||
- name: Проверить наличие обязательных секретов Authentik
|
- name: Проверить наличие обязательных секретов Authentik
|
||||||
@@ -31,6 +32,15 @@
|
|||||||
mode: "0600"
|
mode: "0600"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
|
- name: Установить blueprint каталога пользователей Authentik
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: blueprints/
|
||||||
|
dest: "{{ authentik_dir }}/blueprints/"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
register: authentik_blueprint
|
||||||
|
|
||||||
- name: Запустить сервисы Authentik через Docker Compose
|
- name: Запустить сервисы Authentik через Docker Compose
|
||||||
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml up -d --remove-orphans
|
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml up -d --remove-orphans
|
||||||
register: compose_up
|
register: compose_up
|
||||||
@@ -40,4 +50,14 @@
|
|||||||
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml restart authentik-db authentik-server
|
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml restart authentik-db authentik-server
|
||||||
when: authentik_dirs.changed
|
when: authentik_dirs.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
|
||||||
|
register: authentik_blueprint_apply
|
||||||
|
changed_when: authentik_blueprint.changed
|
||||||
|
retries: 18
|
||||||
|
delay: 10
|
||||||
|
until: authentik_blueprint_apply.rc == 0
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +46,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- {{ authentik_dir }}/media:/media
|
- {{ authentik_dir }}/media:/media
|
||||||
- {{ authentik_dir }}/custom-templates:/templates
|
- {{ authentik_dir }}/custom-templates:/templates
|
||||||
|
- {{ authentik_dir }}/blueprints:/blueprints/custom:ro
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:{{ authentik_http_port }}:9000"
|
- "127.0.0.1:{{ authentik_http_port }}:9000"
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -73,6 +74,7 @@ services:
|
|||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- {{ authentik_dir }}/media:/media
|
- {{ authentik_dir }}/media:/media
|
||||||
- {{ authentik_dir }}/custom-templates:/templates
|
- {{ authentik_dir }}/custom-templates:/templates
|
||||||
|
- {{ authentik_dir }}/blueprints:/blueprints/custom:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
authentik-db:
|
authentik-db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
Reference in new issue
Block a user