blob: f0affe58fceb5c12b640443012e50714c5d41e7d [file] [log] [blame]
Mohammed Naserb7b97d62022-03-12 16:30:00 -05001# 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
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000015- name: Uninstall the legacy HelmRelease
16 run_once: true
17 block:
18 - name: Suspend the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000019 failed_when: false
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000020 kubernetes.core.k8s:
21 state: patched
22 api_version: helm.toolkit.fluxcd.io/v2beta1
23 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000024 name: "{{ libvirt_helm_release_name }}"
25 namespace: "{{ libvirt_helm_release_namespace }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000026 definition:
27 spec:
28 suspend: true
29
30 - name: Remove the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000031 failed_when: false
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000032 kubernetes.core.k8s:
33 state: absent
34 api_version: helm.toolkit.fluxcd.io/v2beta1
35 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000036 name: "{{ libvirt_helm_release_name }}"
37 namespace: "{{ libvirt_helm_release_namespace }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050038
okozachenko120304f9c422023-09-01 23:35:23 +100039- name: Create CA certificates
40 kubernetes.core.k8s:
41 state: present
42 definition:
43 - apiVersion: cert-manager.io/v1
44 kind: Certificate
45 metadata:
46 name: "{{ item }}-ca"
47 namespace: openstack
48 spec:
49 commonName: libvirt
50 duration: 87600h0m0s
51 isCA: true
52 issuerRef:
53 group: cert-manager.io
54 kind: ClusterIssuer
55 name: self-signed
56 privateKey:
57 algorithm: ECDSA
58 size: 256
59 renewBefore: 720h0m0s
60 secretName: "{{ item }}-ca"
61 loop:
62 - libvirt-vnc
63 - libvirt-api
64
okozachenko1203d2cd6872023-08-31 19:53:51 +100065- name: Create Issuers
66 kubernetes.core.k8s:
67 state: present
68 definition:
69 - apiVersion: cert-manager.io/v1
70 kind: Issuer
71 metadata:
72 name: "{{ item }}"
73 namespace: openstack
74 spec:
75 ca:
76 secretName: "{{ item }}-ca"
77 loop:
78 - libvirt-vnc
79 - libvirt-api
80
Mohammed Naserb7b97d62022-03-12 16:30:00 -050081- name: Deploy Helm chart
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000082 run_once: true
83 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000084 name: "{{ libvirt_helm_release_name }}"
85 chart_ref: "{{ libvirt_helm_chart_ref }}"
86 release_namespace: "{{ libvirt_helm_release_namespace }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000087 create_namespace: true
88 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000089 values: "{{ _libvirt_helm_values | combine(libvirt_helm_values, recursive=True) }}"