Files
homelab-infra/ansible/roles/core-secrets/infisical/tasks/main.yml
T
karpenokandCursor 9c692522fb
ansible-core-net / deploy (push) Failing after 39s
ansible-core-secrets / deploy (push) Successful in 30s
ansible-rus-central / deploy (push) Failing after 15s
refactor: split machine deploys from one-time secrets migration
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>
2026-11-10 23:55:34 +07:00

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"