blob: 3c4ce3cb1fed3869294d8638b39787ce9e6bd91d [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
guilhermesteinmullerbc82a042023-01-24 18:20:05 +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
guilhermesteinmullerbc82a042023-01-24 18:20:05 +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: "{{ glance_helm_release_name }}"
25 namespace: "{{ glance_helm_release_namespace }}"
guilhermesteinmullerbc82a042023-01-24 18:20:05 +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
guilhermesteinmullerbc82a042023-01-24 18:20:05 +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: "{{ glance_helm_release_name }}"
37 namespace: "{{ glance_helm_release_namespace }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050038
39- name: Deploy Helm chart
guilhermesteinmullerbc82a042023-01-24 18:20:05 +000040 run_once: true
41 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000042 name: "{{ glance_helm_release_name }}"
43 chart_ref: "{{ glance_helm_chart_ref }}"
44 release_namespace: "{{ glance_helm_release_namespace }}"
guilhermesteinmullerbc82a042023-01-24 18:20:05 +000045 create_namespace: true
46 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000047 values: "{{ _glance_helm_values | combine(glance_helm_values, recursive=True) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050048
49- name: Create Ingress
50 ansible.builtin.include_role:
51 name: openstack_helm_ingress
52 vars:
53 openstack_helm_ingress_endpoint: image
54 openstack_helm_ingress_service_name: glance-api
55 openstack_helm_ingress_service_port: 9292
Mohammed Naser2145fc32023-01-29 23:23:03 +000056 openstack_helm_ingress_annotations: "{{ _glance_ingress_annotations | combine(glance_ingress_annotations) }}"
okozachenkoa6c49ce2022-04-15 01:20:31 +100057
58- name: Create images
Mohammed Naser4b630042023-02-07 20:47:45 +000059 ansible.builtin.include_role:
60 name: glance_image
61 loop: "{{ glance_images }}"
62 vars:
63 glance_image_name: "{{ item.name }}"
64 glance_image_url: "{{ item.url }}"
65 glance_image_min_disk: "{{ item.min_disk | default(omit) }}"
66 glance_image_min_ram: "{{ item.min_ram | default(omit) }}"
67 glance_image_container_format: "{{ item.container_format | default(omit) }}"
68 glance_image_disk_format: "{{ item.disk_format | default(omit) }}"
69 glance_image_properties: "{{ item.properties | default(omit) }}"
70 glance_image_kernel: "{{ item.kernel | default(omit) }}"
71 glance_image_ramdisk: "{{ item.ramdisk | default(omit) }}"
72 glance_image_is_public: "{{ item.is_public | default(omit) }}"