|
| 1 | +--- |
| 2 | +- name: Create temporary directory |
| 3 | + ansible.builtin.tempfile: |
| 4 | + state: directory |
| 5 | + suffix: certificate-build |
| 6 | + register: build_directory |
| 7 | + |
| 8 | +- name: Create directory structure |
| 9 | + ansible.builtin.file: |
| 10 | + state: directory |
| 11 | + path: "{{ build_directory.path }}/ssl-build/{{ certificate_bundle_hostname }}" |
| 12 | + mode: '0755' |
| 13 | + |
| 14 | +- name: Copy CA certificate |
| 15 | + ansible.builtin.copy: |
| 16 | + src: "{{ certificate_bundle_ca_certificate }}" |
| 17 | + dest: "{{ build_directory.path }}/ssl-build/{{ item }}" |
| 18 | + remote_src: true |
| 19 | + mode: '0444' |
| 20 | + loop: |
| 21 | + - katello-server-ca.crt |
| 22 | + - katello-default-ca.crt |
| 23 | + |
| 24 | +- name: Copy server certificate |
| 25 | + ansible.builtin.copy: |
| 26 | + src: "{{ certificate_bundle_server_certificate }}" |
| 27 | + dest: "{{ build_directory.path }}/ssl-build/{{ certificate_bundle_hostname }}/{{ certificate_bundle_hostname }}-{{ item }}" |
| 28 | + remote_src: true |
| 29 | + mode: '0444' |
| 30 | + loop: |
| 31 | + - apache.crt |
| 32 | + - foreman-proxy.crt |
| 33 | + |
| 34 | +- name: Copy server key |
| 35 | + ansible.builtin.copy: |
| 36 | + src: "{{ certificate_bundle_server_key }}" |
| 37 | + dest: "{{ build_directory.path }}/ssl-build/{{ certificate_bundle_hostname }}/{{ certificate_bundle_hostname }}-{{ item }}" |
| 38 | + remote_src: true |
| 39 | + mode: '0440' |
| 40 | + loop: |
| 41 | + - apache.key |
| 42 | + - foreman-proxy.key |
| 43 | + |
| 44 | +- name: Copy client certificate |
| 45 | + ansible.builtin.copy: |
| 46 | + src: "{{ certificate_bundle_client_certificate }}" |
| 47 | + dest: "{{ build_directory.path }}/ssl-build/{{ certificate_bundle_hostname }}/{{ certificate_bundle_hostname }}-{{ item }}" |
| 48 | + remote_src: true |
| 49 | + mode: '0444' |
| 50 | + loop: |
| 51 | + - foreman-proxy-client.crt |
| 52 | + - puppet-client.crt |
| 53 | + |
| 54 | +- name: Copy client key |
| 55 | + ansible.builtin.copy: |
| 56 | + src: "{{ certificate_bundle_client_key }}" |
| 57 | + dest: "{{ build_directory.path }}/ssl-build/{{ certificate_bundle_hostname }}/{{ certificate_bundle_hostname }}-{{ item }}" |
| 58 | + remote_src: true |
| 59 | + mode: '0440' |
| 60 | + loop: |
| 61 | + - foreman-proxy-client.key |
| 62 | + - puppet-client.key |
| 63 | + |
| 64 | +- name: Create tarball |
| 65 | + community.general.archive: |
| 66 | + path: "{{ build_directory.path }}/ssl-build" |
| 67 | + dest: "/root/{{ certificate_bundle_hostname }}.tar.gz" |
| 68 | + mode: '0640' |
0 commit comments