2024-01-04 11:22:21 +00:00
|
|
|
- name: Deploy app
|
|
|
|
hosts: secrets
|
|
|
|
gather_facts: false
|
|
|
|
vars:
|
|
|
|
app: infisical
|
|
|
|
tasks:
|
|
|
|
- name: Wait for connection
|
|
|
|
ansible.builtin.wait_for_connection:
|
|
|
|
timeout: 300
|
|
|
|
- name: Docker compose down
|
2024-01-30 12:37:37 +00:00
|
|
|
community.docker.docker_compose_v2:
|
|
|
|
project_src: "$HOME/{{ app }}"
|
|
|
|
state: absent
|
2024-01-04 11:22:21 +00:00
|
|
|
- name: Copy project
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "./{{ app }}"
|
2024-01-30 12:37:37 +00:00
|
|
|
dest: "$HOME"
|
2024-01-04 11:22:21 +00:00
|
|
|
mode: "0744"
|
2024-01-04 12:50:41 +00:00
|
|
|
|
2024-01-04 11:22:21 +00:00
|
|
|
- name: Replace Encryption Key secret
|
|
|
|
ansible.builtin.replace:
|
2024-01-30 12:37:37 +00:00
|
|
|
path: "$HOME/{{ app }}/.env"
|
2024-01-04 11:22:21 +00:00
|
|
|
regexp: "ENCRYPTION_KEY_VALUE"
|
|
|
|
replace: "{{ lookup('ansible.builtin.env', 'INFISICAL_ENCRYPTION_KEY') }}"
|
|
|
|
- name: Replace Auth secret
|
|
|
|
ansible.builtin.replace:
|
2024-01-30 12:37:37 +00:00
|
|
|
path: "$HOME/{{ app }}/.env"
|
2024-01-04 11:22:21 +00:00
|
|
|
regexp: "AUTH_SECRET_VALUE"
|
|
|
|
replace: "{{ lookup('ansible.builtin.env', 'INFISICAL_AUTH_SECRET') }}"
|
|
|
|
- name: Replace Mongo Password secret
|
|
|
|
ansible.builtin.replace:
|
2024-01-30 12:37:37 +00:00
|
|
|
path: "$HOME/{{ app }}/.env"
|
2024-01-04 11:22:21 +00:00
|
|
|
regexp: "MONGO_PASSWORD_VALUE"
|
|
|
|
replace: "{{ lookup('ansible.builtin.env', 'INFISICAL_MONGO_PASSWORD') }}"
|
|
|
|
- name: Replace SMTP Password secret
|
|
|
|
ansible.builtin.replace:
|
2024-01-30 12:37:37 +00:00
|
|
|
path: "$HOME/{{ app }}/.env"
|
2024-01-04 11:22:21 +00:00
|
|
|
regexp: "SMTP_PASSWORD_VALUE"
|
|
|
|
replace: "{{ lookup('ansible.builtin.env', 'SMTP_PASSWORD') }}"
|
2024-01-04 12:50:41 +00:00
|
|
|
|
2024-01-04 11:22:21 +00:00
|
|
|
- name: Docker compose up -d
|
2024-01-30 12:37:37 +00:00
|
|
|
community.docker.docker_compose_v2:
|
|
|
|
project_src: "$HOME/{{ app }}"
|