| # Copyright (c) 2022 VEXXHOST, Inc. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| # not use this file except in compliance with the License. You may obtain |
| # a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations |
| # under the License. |
| |
| - name: Generate public key for SSH private key |
| ansible.builtin.import_tasks: |
| file: generate_public_key.yml |
| |
| # NOTE(okozachenko1203): We cannot set helm hook for jobs. |
| # As a workaround, remove them before upgrade nova helm release. |
| - name: Remove nova-bootstrap and nova-cell-setup job |
| changed_when: false |
| failed_when: false |
| kubernetes.core.k8s: |
| state: absent |
| api_version: batch/v1 |
| kind: Job |
| name: "{{ item }}" |
| namespace: "{{ nova_helm_release_namespace }}" |
| loop: |
| - nova-bootstrap |
| - nova-cell-setup |
| |
| - name: Deploy Helm chart |
| run_once: true |
| kubernetes.core.helm: |
| name: "{{ nova_helm_release_name }}" |
| chart_ref: "{{ nova_helm_chart_ref }}" |
| release_namespace: "{{ nova_helm_release_namespace }}" |
| create_namespace: true |
| kubeconfig: /etc/kubernetes/admin.conf |
| values: "{{ _nova_helm_values | combine(nova_helm_values, recursive=True) }}" |
| |
| - name: Create Ingress |
| ansible.builtin.include_role: |
| name: openstack_helm_ingress |
| vars: |
| openstack_helm_ingress_endpoint: compute |
| openstack_helm_ingress_service_name: nova-api |
| openstack_helm_ingress_service_port: 8774 |
| openstack_helm_ingress_annotations: "{{ nova_api_ingress_annotations }}" |
| openstack_helm_ingress_class_name: "{{ nova_api_ingress_class_name }}" |
| |
| - name: Create Ingress |
| ansible.builtin.include_role: |
| name: openstack_helm_ingress |
| vars: |
| openstack_helm_ingress_endpoint: compute_novnc_proxy |
| openstack_helm_ingress_service_name: nova-novncproxy |
| openstack_helm_ingress_service_port: 6080 |
| openstack_helm_ingress_annotations: "{{ _nova_novnc_ingress_annotations | combine(nova_novnc_ingress_annotations) }}" |
| openstack_helm_ingress_class_name: "{{ nova_novnc_ingress_class_name }}" |
| |
| - name: Create flavors |
| when: nova_flavors | length > 0 |
| block: |
| - name: Wait until compute api service ready |
| kubernetes.core.k8s_info: |
| api_version: apps/v1 |
| kind: Deployment |
| name: nova-api-osapi |
| namespace: openstack |
| wait_sleep: 10 |
| wait_timeout: 600 |
| wait: true |
| wait_condition: |
| type: Available |
| status: true |
| |
| - name: Create flavors |
| openstack.cloud.compute_flavor: |
| cloud: atmosphere |
| # Flavor settings |
| flavorid: "{{ item.flavorid | default(omit) }}" |
| name: "{{ item.name }}" |
| vcpus: "{{ item.vcpus }}" |
| ram: "{{ item.ram }}" |
| disk: "{{ item.disk | default(omit) }}" |
| ephemeral: "{{ item.ephemeral | default(omit) }}" |
| swap: "{{ item.swap | default(omit) }}" |
| is_public: "{{ item.is_public | default(omit) }}" |
| rxtx_factor: "{{ item.rxtx_factor | default(omit) }}" |
| extra_specs: "{{ item.extra_specs | default(omit) }}" |
| loop: "{{ nova_flavors }}" |
| # NOTE(mnaser): This often fails with a 503 since we're sending a request |
| # way too fast after the service is ready, retry for now |
| # but the Helm chart should be fixed. |
| # |
| # See: https://github.com/vexxhost/atmosphere/issues/72 |
| retries: 60 |
| delay: 5 |
| register: _result |
| until: _result is not failed |