Files
homelab-infra/ansible/roles/core_secrets/tasks/main.yml
T
karpenok 5431e50d1c
ansible-core-net / deploy (push) Failing after 5s
ansible-core-secrets / deploy (push) Failing after 4s
fix(security): remove root password, pin image versions, update compose package
2026-11-10 15:10:58 +07:00

57 lines
2.0 KiB
YAML

---
- name: Установить базовые пакеты Debian
ansible.builtin.apt:
name:
- python3
- ca-certificates
- curl
- rsync
state: present
update_cache: true
- name: Установить Docker и Docker Compose
ansible.builtin.apt:
name:
- docker.io
- docker-compose-v2
state: present
- name: Включить и запустить службу Docker
ansible.builtin.systemd:
name: docker
enabled: true
state: started
- name: Создать каталоги для сервисов secrets
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
loop:
- "{{ secrets_dir }}"
- "{{ vaultwarden_data_dir }}"
- "{{ infisical_data_dir }}"
- 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 для core-secrets
ansible.builtin.template:
src: compose.yaml.j2
dest: "{{ secrets_dir }}/compose.yaml"
owner: root
group: root
mode: "0640"
- name: Запустить сервисы core-secrets через Docker Compose
ansible.builtin.command: docker compose -f {{ secrets_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"