|
29 | 29 | state: directory |
30 | 30 | mode: '0755' |
31 | 31 |
|
32 | | -- name: 'Generate CA certificate' |
33 | | - ansible.builtin.include_tasks: ca.yml |
34 | | - when: certificates_ca |
35 | | - |
36 | | -- name: Issue host certificates |
37 | | - ansible.builtin.include_tasks: host.yml |
38 | | - when: certificates_hostnames is defined |
39 | | - with_items: "{{ certificates_hostnames }}" |
40 | | - loop_control: |
41 | | - loop_var: certificates_hostname |
42 | | - |
43 | | -- name: Create CA bundle with internal CA and custom server CA |
44 | | - ansible.builtin.assemble: |
45 | | - src: "{{ certificates_ca_directory_certs }}" |
46 | | - dest: "{{ certificates_ca_directory_certs }}/ca-bundle.crt" |
47 | | - regexp: '(ca|server-ca)\.crt$' |
48 | | - mode: '0444' |
49 | | - when: |
50 | | - - certificates_source == 'custom_server' |
51 | | - - certificates_custom_server_certificate is defined |
| 32 | +- name: 'Main certs' |
| 33 | + when: certificates_bundle is not defined |
| 34 | + block: |
| 35 | + - name: 'Generate CA certificate' |
| 36 | + ansible.builtin.include_tasks: ca.yml |
| 37 | + when: certificates_ca |
| 38 | + |
| 39 | + - name: Issue host certificates |
| 40 | + ansible.builtin.include_tasks: host.yml |
| 41 | + when: certificates_hostnames is defined |
| 42 | + with_items: "{{ certificates_hostnames }}" |
| 43 | + loop_control: |
| 44 | + loop_var: certificates_hostname |
| 45 | + |
| 46 | + - name: Create CA bundle with internal CA and custom server CA |
| 47 | + ansible.builtin.assemble: |
| 48 | + src: "{{ certificates_ca_directory_certs }}" |
| 49 | + dest: "{{ certificates_ca_directory_certs }}/ca-bundle.crt" |
| 50 | + regexp: '(ca|server-ca)\.crt$' |
| 51 | + mode: '0444' |
| 52 | + when: |
| 53 | + - certificates_source == 'custom_server' |
| 54 | + - certificates_custom_server_certificate is defined |
| 55 | + |
| 56 | +- name: 'Bundle certs' |
| 57 | + when: certificates_bundle is defined |
| 58 | + block: |
| 59 | + - name: 'Unarchive the bundle' |
| 60 | + ansible.builtin.unarchive: |
| 61 | + src: "{{ certificates_bundle }}" |
| 62 | + dest: "{{ certificates_ca_directory }}" |
| 63 | + extra_opts: |
| 64 | + - "--strip-components" |
| 65 | + - "1" |
0 commit comments