refactor: split machine deploys from one-time secrets migration
ansible-core-net / deploy (push) Failing after 39s
ansible-core-secrets / deploy (push) Successful in 30s
ansible-rus-central / deploy (push) Failing after 15s

Roles stay under the machine that runs them, CI applies only a known product, and the /opt/secrets move is a one-shot playbook instead of part of every core-secrets run.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
karpenokandCursor committed 2026-11-10 23:55:34 +07:00
1 parent 341538fba9
commit 9c692522fb
85 files changed
+537 -492

No files matched your search

@@ -0,0 +1,52 @@
---
- name: Создать каталоги для сервиса Authentik с корректными правами
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode }}"
loop:
- { path: "{{ authentik_dir }}", owner: "root", group: "root", mode: "0755" }
- { 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" }
- name: Проверить наличие обязательных секретов Authentik
ansible.builtin.assert:
that:
- authentik_secret_key is defined and authentik_secret_key | length > 0
- authentik_postgres_password is defined and authentik_postgres_password | length > 0
fail_msg: "Один или оба секрета Authentik (AUTHENTIK_SECRET_KEY, AUTHENTIK_POSTGRES_PASSWORD) не переданы через переменные окружения!"
- name: Установить compose.yaml для Authentik
ansible.builtin.template:
src: compose.yaml.j2
dest: "{{ authentik_dir }}/compose.yaml"
owner: root
group: root
mode: "0600"
no_log: true
- name: Синхронизировать blueprints Authentik
ansible.builtin.copy:
src: blueprints/
dest: "{{ authentik_dir }}/blueprints/"
owner: root
group: root
mode: "0644"
register: authentik_blueprint
- name: Запустить сервисы Authentik через Docker Compose
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml up -d --remove-orphans
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 при обновлении blueprints
ansible.builtin.command: docker compose -f {{ authentik_dir }}/compose.yaml restart authentik-worker
when: authentik_blueprint.changed and not compose_up.changed