blob: 4ed0fe8ee0ce36b7ed9d8e06b2d1d56f350d78c5 [file] [log] [blame]
# 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 OpenStack-Helm endpoints
ansible.builtin.include_role:
name: openstack_helm_endpoints
vars:
openstack_helm_endpoints_repo_name: "{{ openstack_helm_nova_chart_repo_name }}"
openstack_helm_endpoints_repo_url: "{{ openstack_helm_nova_chart_repo_url }}"
openstack_helm_endpoints_chart: "{{ openstack_helm_nova_chart_name }}"
- name: Generate Helm values comparison
ansible.builtin.include_role:
name: helm_diff
vars:
helm_diff_release_name: "{{ openstack_helm_nova_chart_name }}"
helm_diff_release_namespace: openstack
helm_diff_values: "{{ _openstack_helm_nova_values }}"
when:
- openstack_helm_nova_diff | bool
- name: Migrate database from MariaDB to Percona XtraDB Cluster
ansible.builtin.include_role:
name: openstack_helm_migrate_to_percona_xtradb_cluster
vars:
openstack_helm_migrate_to_percona_xtradb_cluster_release_name: "{{ openstack_helm_nova_chart_name }}"
openstack_helm_migrate_to_percona_xtradb_cluster_release_namespace: openstack
openstack_helm_migrate_to_percona_xtradb_cluster_databases:
- nova
- nova_api
- nova_cell0
openstack_helm_migrate_to_percona_xtradb_cluster_services:
- kind: Deployment
name: nova-api-metadata
- kind: Deployment
name: nova-api-osapi
- kind: Deployment
name: nova-conductor
- kind: Deployment
name: nova-scheduler
when:
- openstack_helm_nova_migrate_from_mariadb | bool
- name: Generate public key for SSH private key
become: false
delegate_to: localhost
block:
- name: Generate temporary file for SSH public key
changed_when: false
ansible.builtin.tempfile:
state: file
prefix: nova_ssh_key_
register: _nova_ssh_key_tempfile
# NOTE(mnaser): It's important to add a trailing newline at the end of this
# string or else `ssh-keygen` will not be happy.`
- name: Write contents of current private SSH key
changed_when: false
ansible.builtin.copy:
dest: "{{ _nova_ssh_key_tempfile.path }}"
content: "{{ openstack_helm_nova_ssh_key }}\n"
- name: Generate public key for SSH private key
changed_when: false
community.crypto.openssh_keypair:
path: "{{ _nova_ssh_key_tempfile.path }}"
regenerate: never
register: _nova_ssh_publickey
always:
- name: Delete temporary file for public SSH key
changed_when: false
ansible.builtin.file:
path: "{{ _nova_ssh_key_tempfile.path }}"
state: absent
- name: Deploy Helm chart
kubernetes.core.helm:
name: "{{ openstack_helm_nova_chart_name }}"
chart_ref: "{{ openstack_helm_nova_chart_repo_name }}/{{ openstack_helm_nova_chart_name }}"
chart_version: 0.2.32
release_namespace: openstack
kubeconfig: /etc/kubernetes/admin.conf
values: "{{ _openstack_helm_nova_values }}"
# NOTE(mnaser): This is a a workaround due to the fact that Nova's online
# data migrations take forever.
timeout: 10m
- 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: "{{ openstack_helm_nova_ingress_annotations }}"
- 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: "{{ openstack_helm_nova_ingress_annotations }}"
- 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: "{{ openstack_helm_nova_flavors }}"