blob: 4db1de46670cd02eb69dcc983a9aabdb3b0a8c9b [file] [log] [blame]
okozachenko43771bd2022-04-30 01:22:46 +10001# 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
guilhermesteinmuller6f99fc52023-01-24 17:41:53 +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
guilhermesteinmuller6f99fc52023-01-24 17:41:53 +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: "{{ barbican_helm_release_name }}"
25 namespace: "{{ barbican_helm_release_namespace }}"
guilhermesteinmuller6f99fc52023-01-24 17:41:53 +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
guilhermesteinmuller6f99fc52023-01-24 17:41:53 +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: "{{ barbican_helm_release_name }}"
37 namespace: "{{ barbican_helm_release_namespace }}"
okozachenko43771bd2022-04-30 01:22:46 +100038
39- name: Deploy Helm chart
guilhermesteinmuller6f99fc52023-01-24 17:41:53 +000040 run_once: true
41 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000042 name: "{{ barbican_helm_release_name }}"
43 chart_ref: "{{ barbican_helm_chart_ref }}"
44 release_namespace: "{{ barbican_helm_release_namespace }}"
guilhermesteinmuller6f99fc52023-01-24 17:41:53 +000045 create_namespace: true
46 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000047 values: "{{ _barbican_helm_values | combine(barbican_helm_values, recursive=True) }}"
okozachenko43771bd2022-04-30 01:22:46 +100048
49- name: Create Ingress
50 ansible.builtin.include_role:
51 name: openstack_helm_ingress
52 vars:
Julian Poss0aad3332022-05-18 09:37:20 +000053 openstack_helm_ingress_endpoint: key_manager
okozachenko43771bd2022-04-30 01:22:46 +100054 openstack_helm_ingress_service_name: barbican-api
55 openstack_helm_ingress_service_port: 9311
Mohammed Naser2145fc32023-01-29 23:23:03 +000056 openstack_helm_ingress_annotations: "{{ barbican_ingress_annotations }}"
vexxhost-bot7f4ca4d2024-04-21 17:03:14 -040057
58- name: Create creator role
59 openstack.cloud.identity_role:
60 cloud: atmosphere
61 state: present
62 name: creator
63
64- name: Add implied roles
65 run_once: true
66 ansible.builtin.shell: |
vexxhost-botb775bab2024-05-02 12:04:34 -040067 set -o posix
68 source /etc/profile.d/atmosphere.sh
vexxhost-bot7f4ca4d2024-04-21 17:03:14 -040069 openstack implied role create \
70 --implied-role {{ item.implies }} \
71 {{ item.role }}
vexxhost-botb775bab2024-05-02 12:04:34 -040072 args:
73 executable: /bin/bash
vexxhost-bot7f4ca4d2024-04-21 17:03:14 -040074 loop:
75 - role: member
76 implies: creator
77 environment:
78 OS_CLOUD: atmosphere
79 register: _octavia_implied_role_create
80 changed_when: _octavia_implied_role_create.rc == 0
81 failed_when: _octavia_implied_role_create.rc != 0 and 'Duplicate entry.' not in _octavia_implied_role_create.stderr
Mohammed Naserebcd7d72024-06-20 11:42:28 -040082 retries: 10
83 delay: 1
84 until: _octavia_implied_role_create.rc == 0 or 'Duplicate entry.' in _octavia_implied_role_create.stderr