-
Notifications
You must be signed in to change notification settings - Fork 3
/
upgrade-database-ocata.yml
96 lines (79 loc) · 3.74 KB
/
upgrade-database-ocata.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
- name: Prepare Virt Environments
hosts: localhost
tasks:
- name: Perform ocata Keystone DB sync
shell: "/root/upgrade-venvs/ocata/bin/keystone-manage db_sync"
- name: Perform ocata glance DB sync
shell: "/root/upgrade-venvs/ocata/bin/glance-manage db sync"
- name: Perform ocata cinder DB sync
shell: "/root/upgrade-venvs/ocata/bin/cinder-manage db sync"
- name: Perform online data migrations ocata cinder
shell: "/root/upgrade-venvs/ocata/bin/cinder-manage db online_data_migrations"
- name: create cell db
hosts: galera[0]
tasks:
- name: Create DB for service
mysql_db:
name: nova_cell0
state: present
- name: Grant access to DBs for the services
mysql_user:
name: "{{ item['name'] }}"
password: "{{ item['password'] }}"
host: "{{ item['host'] }}"
state: "present"
priv: "{{ item['database'] }}.*:ALL"
append_privs: "{{ item['db_append_privs'] | default(omit) }}"
with_items:
- name: "nova_api"
password: "{{ nova_api_container_mysql_password }}"
host: "localhost"
database: "nova_cell0"
db_append_privs: "yes"
- name: "nova_api"
password: "{{ nova_api_container_mysql_password }}"
host: "%"
database: "nova_cell0"
db_append_privs: "yes"
- name: map cells
hosts: localhost
tasks:
- name: Create the cell0 mapping entry in the nova API DB
command: >-
/root/upgrade-venvs/ocata/bin/nova-manage cell_v2 map_cell0
--database_connection mysql+pymysql://nova_api:{{ nova_api_container_mysql_password }}@{{ galera_address }}/nova_cell0?charset=utf8
changed_when: false
- name: Create the cell1 mapping entry in the nova API DB
command: >-
/root/upgrade-venvs/ocata/bin/nova-manage cell_v2 create_cell
--name cell1
--database_connection mysql+pymysql://nova:{{ nova_container_mysql_password }}@{{ galera_address }}/nova?charset=utf8
--transport-url rabbit://{% for host in nova_rabbitmq_servers.split(',') %}{{ nova_rabbitmq_userid }}:{{ nova_rabbitmq_password }}@{{ host }}:{{ nova_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ nova_rabbitmq_vhost }}{% endif %}{% endfor %}?ssl=0
register: nova_cell1_create
failed_when: "nova_cell1_create.rc not in [0, 2]"
changed_when: "nova_cell1_create.rc == 0"
- name: Get UUID of new Nova Cell
shell: "/root/upgrade-venvs/ocata/bin/nova-manage cell_v2 list_cells | grep ' cell1 '"
register: cell1_uuid
changed_when: false
when: "nova_cell1_create.rc == 0"
- name: Map instances to new Cell1
command: "/root/upgrade-venvs/ocata/bin/nova-manage cell_v2 map_instances --cell_uuid {{ cell1_uuid['stdout'].split()[3] }}"
changed_when: false
when: "nova_cell1_create.rc == 0"
- name: Perform ocata Nova API DB sync
shell: "/root/upgrade-venvs/ocata/bin/nova-manage api_db sync"
- name: Perform ocata Nova DB sync
shell: "/root/upgrade-venvs/ocata/bin/nova-manage db sync"
- name: Perform ocata online data migrations
shell: "/root/upgrade-venvs/ocata/bin/nova-manage db online_data_migrations"
- name: Perform ocata neutron DB upgrade
shell: "/root/upgrade-venvs/ocata/bin/neutron-db-manage upgrade --expand"
- name: Perform ocata neutron DB offline migrations
shell: "/root/upgrade-venvs/ocata/bin/neutron-db-manage has_offline_migrations"
- name: Perform ocata designate DB upgrade
shell: "/root/upgrade-venvs/ocata/bin/designate-manage database sync"
when: groups['designate_all'] | default('') |length > 0
- name: Perform ocata heat DB upgrade
shell: "/root/upgrade-venvs/ocata/bin/heat-manage db_sync"