blob: 1f6d636da38a0ddf7f75ad1c74a0610d95453bfd [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
16 block:
17 - name: Wait till the secret is created
18 kubernetes.core.k8s_info:
19 api_version: v1
20 kind: Secret
21 name: cert-manager-selfsigned-ca
22 namespace: openstack
23 wait: true
24 wait_sleep: 1
25 wait_timeout: 300
26 register: _openstack_helm_root_secret
Mohammed Naser625b1e42022-09-30 22:09:10 +000027 when: atmosphere_issuer_config.type == "self-signed"
Mohammed Naser57b53392022-09-30 19:39:07 +000028
29 - name: Wait till the secret is created
30 kubernetes.core.k8s_info:
31 api_version: v1
32 kind: Secret
33 name: cert-manager-issuer-ca
34 namespace: openstack
35 wait: true
36 wait_sleep: 1
37 wait_timeout: 300
38 register: _openstack_helm_root_secret
Mohammed Naser625b1e42022-09-30 22:09:10 +000039 when: atmosphere_issuer_config.type == "ca"
Mohammed Naser57b53392022-09-30 19:39:07 +000040
41 - name: Copy CA certificate on host
42 ansible.builtin.copy:
43 content: "{{ _openstack_helm_root_secret.resources[0].data['tls.crt'] | b64decode }}"
44 dest: "/usr/local/share/ca-certificates/self-signed-osh-ca.crt"
45 mode: "0644"
46
47 - name: Update CA certificates on host
48 ansible.builtin.command:
49 cmd: update-ca-certificates
50 changed_when: false
51 when:
Mohammed Naser625b1e42022-09-30 22:09:10 +000052 - atmosphere_issuer_config.type is defined
53 - atmosphere_issuer_config.type in ("self-signed", "ca")