From 1f7304fef7e14039a64f8773851016bf4d2b45bd Mon Sep 17 00:00:00 2001 From: Matt Reeves Date: Tue, 31 Dec 2024 22:31:33 -0500 Subject: [PATCH] testing --- ansible/playbooks/deploy-docker.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ansible/playbooks/deploy-docker.yml b/ansible/playbooks/deploy-docker.yml index 3aa74c1..0b54547 100644 --- a/ansible/playbooks/deploy-docker.yml +++ b/ansible/playbooks/deploy-docker.yml @@ -1,4 +1,3 @@ ---- - name: Deploy application hosts: "{{ target_host }}" vars: @@ -14,15 +13,18 @@ ansible.builtin.set_fact: secret_mapping: "{{ secret_mapping_content['content'] | b64decode | from_yaml }}" + - name: Set env_variables + ansible.builtin.set_fact: + env_variables: "{{ secret_mapping[target_host]['env_variables'] | default({}) }}" + - name: Write .env file to target host ansible.builtin.copy: dest: "{{ repo_path }}/.env" content: | {% for key, secret_id in env_variables.items() %} - {{ key }}={{ lookup('community.general.bws', secret_id, base_url='https://vault.bitwarden.com', access_token=bw_access_token) }} + {{ key }}={{ lookup('community.general.bws', secret_id, base_url='https://vault.bitwarden.com', access_token=lookup('env', 'BW_ACCESS_TOKEN')) }} {% endfor %} - - name: Verify .env file content ansible.builtin.shell: cat "{{ repo_path }}/.env" register: env_file_content