36 lines
1.4 KiB
YAML
36 lines
1.4 KiB
YAML
---
|
|
- name: Создать каталоги для сервиса Authentik
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0750"
|
|
loop:
|
|
- "{{ authentik_dir }}"
|
|
- "{{ authentik_dir }}/db"
|
|
- "{{ authentik_dir }}/redis"
|
|
- "{{ authentik_dir }}/media"
|
|
- "{{ authentik_dir }}/custom-templates"
|
|
|
|
- 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: Запустить сервисы 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"
|