During deploy, always sync DB

A common class of problems goes like this:

* kolla-ansible deploy
* Hit a problem, often in ansible/roles/*/tasks/bootstrap.yml
* Re-run kolla-ansible deploy
* Service fails to start

This happens because the DB is created during the first run, but for some
reason we fail before performing the DB sync. This means that on the second run
we don't include ansible/roles/*/tasks/bootstrap_service.yml because the DB
already exists, and therefore still don't perform the DB sync. However this
time, the command may complete without apparent error.

We should be less careful about when we perform the DB sync, and do it whenever
it is necessary. There is an argument for not doing the sync during a
'reconfigure' command, although we will not change that here.

This change only always performs the DB sync during 'deploy' and
'reconfigure' commands.

Change-Id: I82d30f3fcf325a3fdff3c59f19a1f88055b566cc
Closes-Bug: #1823766
Closes-Bug: #1797814
This commit is contained in:
Mark Goddard 2019-04-08 17:51:07 +01:00 committed by Radosław Piliszek
parent 103e0e43e7
commit d5e5e885d1
36 changed files with 0 additions and 77 deletions

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ aodh_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['aodh-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ barbican_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['barbican-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ blazar_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['blazar-api'][0] }}"
@ -55,4 +54,3 @@
delegate_to: "{{ groups['blazar-api'][0] }}"
- include_tasks: bootstrap_service.yml
when: database.changed

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ cinder_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['cinder-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ cloudkitty_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['cloudkitty-api'][0] }}"
when:
@ -45,4 +44,3 @@
when: cloudkitty_storage_backend == 'influxdb'
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ congress_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['congress-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ cyborg_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['cyborg-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ item }}"
register: database
run_once: True
delegate_to: "{{ groups['designate-central'][0] }}"
with_items:
@ -46,4 +45,3 @@
no_log: true
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_password: "{{ database_password }}"
name: "{{ freezer_database_name }}"
become: true
register: database
run_once: True
delegate_to: "{{ groups['freezer-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ glance_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['glance-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ gnocchi_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['gnocchi-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ heat_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['heat-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ horizon_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['horizon'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ item.database_name }}"
register: database
run_once: True
delegate_to: "{{ groups[item.group][0] }}"
with_items:
@ -53,7 +52,6 @@
- inventory_hostname in groups[item.group]
- include_tasks: bootstrap_service.yml
when: database.changed
- name: Running Ironic-PXE bootstrap container
vars:

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ karbor_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['karbor-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ keystone_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['keystone'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ magnum_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['magnum-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ manila_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['manila-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ mistral_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['mistral-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ item }}"
register: database
run_once: True
delegate_to: "{{ groups['monasca-api'][0] }}"
with_items:
@ -36,10 +35,8 @@
delegate_to: "{{ groups['monasca-api'][0] }}"
when:
- not use_preconfigured_databases | bool
- database.changed
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool
# NOTE(dszumski): Monasca is not yet compatible with InfluxDB > 1.1.10, which means
# that the official Ansible modules for managing InfluxDB don't work [1].

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ murano_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['murano-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ neutron_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['neutron-server'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ item }}"
register: database
run_once: True
delegate_to: "{{ groups['nova-api'][0] }}"
with_items:
@ -48,9 +47,7 @@
run_once: True
delegate_to: "{{ groups['nova-api'][0] }}"
when:
- database.changed
- not use_preconfigured_databases | bool
no_log: true
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ octavia_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -20,7 +20,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ panko_database_name }}"
register: mysql_panko_database
run_once: True
delegate_to: "{{ groups['panko-api'][0] }}"
when:
@ -48,6 +47,3 @@
- panko_database_type == "mysql"
- include_tasks: bootstrap_service.yml
when: (panko_database_type == "mongodb" and mongodb_panko_database.changed)
or (panko_database_type == "mysql" and mysql_panko_database.changed)
or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ placement_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['placement-api'][0] }}"
when:
@ -32,8 +31,6 @@
run_once: True
delegate_to: "{{ groups['placement-api'][0] }}"
when:
- database.changed
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ qinling_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['qinling-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ rally_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['rally'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ sahara_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['sahara-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ senlin_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['senlin-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ solum_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['solum-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ tacker_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['tacker-server'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ trove_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['trove-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ vitrage_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['vitrage-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ watcher_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['watcher-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

View File

@ -9,7 +9,6 @@
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ zun_database_name }}"
register: database
run_once: True
delegate_to: "{{ groups['zun-api'][0] }}"
when:
@ -35,4 +34,3 @@
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool