|
7 | 7 | image_tag: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:image_tag') }}"
|
8 | 8 | replicas: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:replicas') }}"
|
9 | 9 | domain_name: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:domain_name') }}"
|
10 |
| - fullchain: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:fullchain') }}" |
11 |
| - privkey: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:privkey') }}" |
| 10 | + use_https: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:use_https') }}" |
12 | 11 | destination_directory: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:destination_directory') }}"
|
13 | 12 | tasks:
|
14 | 13 | - name: Copy file from host to machine
|
|
34 | 33 | state: directory
|
35 | 34 | mode: "0755"
|
36 | 35 |
|
| 36 | + - name: Pull Certificates |
| 37 | + set_fact: |
| 38 | + fullchain: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:fullchain') }}" |
| 39 | + privkey: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/prod/nginx:privkey') }}" |
| 40 | + when: use_https == "true" |
| 41 | + |
37 | 42 | - name: Create fullchain.pem
|
38 | 43 | copy:
|
39 | 44 | dest: /nginx/certificates/{{ domain_name }}/fullchain.pem
|
40 | 45 | content: |
|
41 | 46 | {{ fullchain }}
|
| 47 | + when: use_https == "true" |
42 | 48 |
|
43 | 49 | - name: Create privkey.pem
|
44 | 50 | copy:
|
45 | 51 | dest: /nginx/certificates/{{ domain_name }}/privkey.pem
|
46 | 52 | content: |
|
47 | 53 | {{ privkey }}
|
48 |
| -
|
| 54 | + when: use_https == "true" |
| 55 | + |
49 | 56 | - name: Retrieve environment file from Vault
|
50 | 57 | set_fact:
|
51 | 58 | env_file: "{{ lookup('hashi_vault', 'secret=secret/data/generate') }}"
|
|
0 commit comments