blob: d73211836a71d34ae7d6d671432d3694b3c003bb [file] [log] [blame]
Mohammed Naser0a13cee2023-03-02 11:28:29 +01001# Copyright (c) 2023 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
15- name: Generate public key for SSH private key
16 ansible.builtin.import_tasks:
17 file: generate_public_key.yml
18
19- name: Generate configuration difference
20 ansible.builtin.include_role:
21 name: osa_config_diff
22 vars:
23 osa_config_diff_containers_group: nova_conductor
24 osa_config_diff_chart_ref: "{{ nova_helm_chart_ref }}"
25 osa_config_diff_release_namespace: "{{ nova_helm_release_namespace }}"
26 osa_config_diff_release_values: "{{ _nova_helm_values | combine(nova_helm_values, recursive=True) }}"
27 osa_config_diff_config_files:
28 nova.conf: /etc/nova/nova.conf
29
30- name: Migrate the databases
31 ansible.builtin.include_role:
32 name: migrate_db_from_osa
33 vars:
34 migrate_db_from_osa_pxc_namespace: "{{ nova_helm_release_namespace }}"
35 migrate_db_from_osa_containers_group: nova_conductor
36 migrate_db_from_osa_databases:
37 nova: nova
38 nova_api: nova_api
39 nova_cell0: nova_cell0
40
41- name: Get the Kuberentes service for Percona XtraDB Cluster
42 run_once: true
43 kubernetes.core.k8s_info:
44 kind: Service
45 name: "{{ openstack_helm_endpoints.oslo_db.hosts.default }}"
46 namespace: "{{ nova_helm_release_namespace }}"
47 register: _nova_pxc_service
48
49- name: Update cell mappings
50 run_once: true
51 delegate_to: "{{ groups['galera_all'][0] }}"
52 community.mysql.mysql_query:
53 login_host: "{{ _nova_pxc_service.resources[0].spec.clusterIP }}"
54 login_user: root
55 login_password: "{{ openstack_helm_endpoints.oslo_db.auth.admin.password }}"
56 login_db: nova_api
57 query: UPDATE cell_mappings SET transport_url = %(transport_url)s, database_connection = %(database_connection)s WHERE name = %(name)s
58 named_args: "{{ item }}"
59 loop:
60 - name: cell0
61 transport_url: none:/
Mohammed Nasera8950ec2023-03-05 19:28:27 +000062 database_connection: "mysql+pymysql://nova:{{ openstack_helm_endpoints.oslo_db_cell0.auth.nova.password }}@percona-xtradb-haproxy.openstack.svc.cluster.local:3306/nova_cell0" # noqa yaml[line-length]
Mohammed Naser0a13cee2023-03-02 11:28:29 +010063 - name: cell1
64 transport_url: "rabbit://nova:{{ openstack_helm_endpoints.oslo_messaging.auth.nova.password }}@rabbitmq-nova.openstack.svc.cluster.local:5672/nova"
Mohammed Nasera8950ec2023-03-05 19:28:27 +000065 database_connection: "mysql+pymysql://nova:{{ openstack_helm_endpoints.oslo_db.auth.nova.password }}@percona-xtradb-haproxy.openstack.svc.cluster.local:3306/nova" # noqa yaml[line-length]
Mohammed Naser0a13cee2023-03-02 11:28:29 +010066 loop_control:
67 label: "{{ item.name }}"
68
69- name: Run deployment flow
70 ansible.builtin.import_tasks:
71 file: main.yml
72
73- name: Get the Kuberentes service for RabbitMQ
74 run_once: true
75 kubernetes.core.k8s_info:
76 kind: Service
77 name: "{{ openstack_helm_endpoints.oslo_messaging.hosts.default }}"
78 namespace: "{{ nova_helm_release_namespace }}"
79 register: _nova_rabbitmq_service
80
81- name: Update RabbitMQ configuration for compute nodes
82 delegate_to: "{{ item.0 }}"
83 community.general.ini_file:
84 path: /etc/nova/nova.conf
85 section: "{{ item.1.section }}"
86 option: "{{ item.1.option }}"
87 value: "{{ item.1.value }}"
Mohammed Nasera8950ec2023-03-05 19:28:27 +000088 mode: "0644"
Mohammed Naser0a13cee2023-03-02 11:28:29 +010089 with_nested:
90 - "{{ groups['nova_compute'] }}"
91 - - section: DEFAULT
92 option: transport_url
93 value: "rabbit://nova:{{ openstack_helm_endpoints.oslo_messaging.auth.nova.password }}@{{ cluster_ip }}:5672/nova"
94 - section: oslo_messaging_notifications
95 option: transport_url
96 value: "rabbit://nova:{{ openstack_helm_endpoints.oslo_messaging.auth.nova.password }}@{{ cluster_ip }}:5672/nova"
97 - section: oslo_messaging_rabbit
98 option: ssl
99 value: false
100 vars:
101 cluster_ip: "{{ _nova_rabbitmq_service.resources[0].spec.clusterIP }}"
102
103- name: Restart all compute services
104 delegate_to: "{{ item }}"
105 ansible.builtin.service:
106 name: nova-compute
107 state: restarted
108 with_items: "{{ groups['nova_compute'] }}"
109
110- name: Migrate HAproxy (API)
111 ansible.builtin.include_role:
112 name: migrate_haproxy_from_osa
113 vars:
114 migrate_haproxy_from_osa_group: nova_conductor
115 migrate_haproxy_from_osa_service_namespace: "{{ nova_helm_release_namespace }}"
116 migrate_haproxy_from_osa_service_name: nova-api
117 migrate_haproxy_from_osa_haproxy_backend: nova_api_os_compute
118
119- name: Migrate HAproxy (Metadata)
120 ansible.builtin.include_role:
121 name: migrate_haproxy_from_osa
122 vars:
123 migrate_haproxy_from_osa_group: nova_conductor
124 migrate_haproxy_from_osa_service_namespace: "{{ nova_helm_release_namespace }}"
125 migrate_haproxy_from_osa_service_name: nova-metadata
126 migrate_haproxy_from_osa_haproxy_backend: nova_api_metadata
127
128- name: Migrate HAproxy (VNC)
129 ansible.builtin.include_role:
130 name: migrate_haproxy_from_osa
131 vars:
132 migrate_haproxy_from_osa_group: nova_conductor
133 migrate_haproxy_from_osa_service_namespace: "{{ nova_helm_release_namespace }}"
134 migrate_haproxy_from_osa_service_name: nova-novncproxy
135 migrate_haproxy_from_osa_haproxy_backend: nova_console