blob: 4cdb916fc6a0fe32d9972a4da975b6fe489c666e [file] [log] [blame]
Mohammed Naser57b53392022-09-30 19:39:07 +00001# 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 Naser4b24d9b2022-11-02 13:14:52 -040016 when:
17 - atmosphere_issuer_config.type is defined
18 - atmosphere_issuer_config.type in ("self-signed", "ca")
Mohammed Naser57b53392022-09-30 19:39:07 +000019 block:
20 - name: Wait till the secret is created
21 kubernetes.core.k8s_info:
22 api_version: v1
23 kind: Secret
Mohammed Naser6e557c82022-10-01 20:10:13 +000024 name: "{{ (atmosphere_issuer_config.type == 'self-signed') | ternary('cert-manager-selfsigned-ca', 'cert-manager-issuer-ca') }}"
Mohammed Naserbb89a842022-11-14 19:49:36 +000025 namespace: cert-manager
Mohammed Naser57b53392022-09-30 19:39:07 +000026 wait: true
27 wait_sleep: 1
28 wait_timeout: 300
29 register: _openstack_helm_root_secret
Mohammed Naser57b53392022-09-30 19:39:07 +000030
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