testing
This commit is contained in:
parent
30537cfc63
commit
1f7304fef7
1 changed files with 5 additions and 3 deletions
|
@ -1,4 +1,3 @@
|
||||||
---
|
|
||||||
- name: Deploy application
|
- name: Deploy application
|
||||||
hosts: "{{ target_host }}"
|
hosts: "{{ target_host }}"
|
||||||
vars:
|
vars:
|
||||||
|
@ -14,15 +13,18 @@
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
secret_mapping: "{{ secret_mapping_content['content'] | b64decode | from_yaml }}"
|
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
|
- name: Write .env file to target host
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ repo_path }}/.env"
|
dest: "{{ repo_path }}/.env"
|
||||||
content: |
|
content: |
|
||||||
{% for key, secret_id in env_variables.items() %}
|
{% 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 %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
- name: Verify .env file content
|
- name: Verify .env file content
|
||||||
ansible.builtin.shell: cat "{{ repo_path }}/.env"
|
ansible.builtin.shell: cat "{{ repo_path }}/.env"
|
||||||
register: env_file_content
|
register: env_file_content
|
||||||
|
|
Loading…
Reference in a new issue