Mohammed Naser | 57b5339 | 2022-09-30 19:39:07 +0000 | [diff] [blame] | 1 | # Copyright (c) 2022 VEXXHOST, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | - name: Bootstrap PKI |
Mohammed Naser | 4b24d9b | 2022-11-02 13:14:52 -0400 | [diff] [blame] | 16 | when: |
| 17 | - atmosphere_issuer_config.type is defined |
| 18 | - atmosphere_issuer_config.type in ("self-signed", "ca") |
Mohammed Naser | 57b5339 | 2022-09-30 19:39:07 +0000 | [diff] [blame] | 19 | block: |
| 20 | - name: Wait till the secret is created |
| 21 | kubernetes.core.k8s_info: |
| 22 | api_version: v1 |
| 23 | kind: Secret |
Mohammed Naser | 6e557c8 | 2022-10-01 20:10:13 +0000 | [diff] [blame] | 24 | name: "{{ (atmosphere_issuer_config.type == 'self-signed') | ternary('cert-manager-selfsigned-ca', 'cert-manager-issuer-ca') }}" |
Mohammed Naser | bb89a84 | 2022-11-14 19:49:36 +0000 | [diff] [blame] | 25 | namespace: cert-manager |
Mohammed Naser | 57b5339 | 2022-09-30 19:39:07 +0000 | [diff] [blame] | 26 | wait: true |
| 27 | wait_sleep: 1 |
| 28 | wait_timeout: 300 |
| 29 | register: _openstack_helm_root_secret |
Mohammed Naser | 57b5339 | 2022-09-30 19:39:07 +0000 | [diff] [blame] | 30 | |
| 31 | - name: Copy CA certificate on host |
| 32 | ansible.builtin.copy: |
| 33 | content: "{{ _openstack_helm_root_secret.resources[0].data['tls.crt'] | b64decode }}" |
| 34 | dest: "/usr/local/share/ca-certificates/self-signed-osh-ca.crt" |
| 35 | mode: "0644" |
| 36 | |
| 37 | - name: Update CA certificates on host |
| 38 | ansible.builtin.command: |
| 39 | cmd: update-ca-certificates |
| 40 | changed_when: false |