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>
35 lines
1.6 KiB
YAML
35 lines
1.6 KiB
YAML
---
|
|
- name: Создать каталоги Infisical
|
|
ansible.builtin.file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: "{{ item.owner }}"
|
|
group: "{{ item.group }}"
|
|
mode: "{{ item.mode }}"
|
|
loop:
|
|
- { path: "{{ infisical_dir }}", owner: "root", group: "root", mode: "0755" }
|
|
- { path: "{{ infisical_dir }}/db", owner: "70", group: "70", mode: "0700" }
|
|
- { path: "{{ infisical_dir }}/redis", owner: "999", group: "999", mode: "0700" }
|
|
|
|
- name: Проверить наличие обязательных секретов Infisical
|
|
ansible.builtin.assert:
|
|
that:
|
|
- infisical_postgres_password is defined and infisical_postgres_password | length > 0
|
|
- infisical_encryption_key is defined and infisical_encryption_key | length > 0
|
|
- infisical_auth_secret is defined and infisical_auth_secret | length > 0
|
|
fail_msg: "Один или несколько обязательных секретов (INFISICAL_POSTGRES_PASSWORD, INFISICAL_ENCRYPTION_KEY, INFISICAL_AUTH_SECRET) не переданы через переменные окружения."
|
|
|
|
- name: Установить compose.yaml для Infisical
|
|
ansible.builtin.template:
|
|
src: compose.yaml.j2
|
|
dest: "{{ infisical_dir }}/compose.yaml"
|
|
owner: root
|
|
group: root
|
|
mode: "0600"
|
|
no_log: true
|
|
|
|
- name: Запустить Infisical
|
|
ansible.builtin.command: docker compose -f {{ infisical_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"
|