6c037790f2
Ansible 2.14.3 introduced a change that broke the method used for
restarting MariaDB and RabbitMQ serially [1][2]. In
I57425680a4cdbf0daeb9b2cc35920f1b933aa4a8 we limited to 2.14.2 to work
around this. Ansible upstream claim this behaviour was unintentional,
and will not fix it.
This change moves to a different approach where we use separate plays
with a 'serial' keyword to execute the restart.
This change also removes the restriction on the maximum supported
version of 2.14.2 on ansible-core - any 2.14 release is now supported.
[1] 65366f663d
[2] https://github.com/ansible/ansible/issues/80848
Depends-On: https://review.opendev.org/c/openstack/kolla/+/884208
Change-Id: I5a12670d07077d24047aaff57ce8d33ccf7156ff
92 lines
2.8 KiB
YAML
92 lines
2.8 KiB
YAML
---
|
|
- name: Starting first MariaDB container
|
|
vars:
|
|
service_name: "mariadb"
|
|
service: "{{ mariadb_services[service_name] }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "start_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
environment:
|
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
|
BOOTSTRAP_ARGS: "--wsrep-new-cluster"
|
|
image: "{{ service.image }}"
|
|
labels:
|
|
BOOTSTRAP:
|
|
name: "{{ service.container_name }}"
|
|
restart_policy: no
|
|
volumes: "{{ service.volumes }}"
|
|
dimensions: "{{ service.dimensions }}"
|
|
listen: Bootstrap MariaDB cluster
|
|
|
|
# NOTE(yoctozepto): We have to loop this to avoid breaking on connection resets
|
|
- name: Wait for first MariaDB service port liveness
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ mariadb_port }}"
|
|
connect_timeout: 1
|
|
timeout: 60
|
|
search_regex: "MariaDB"
|
|
register: check_mariadb_port
|
|
until: check_mariadb_port is success
|
|
retries: 10
|
|
delay: 6
|
|
listen: Bootstrap MariaDB cluster
|
|
|
|
- name: Wait for first MariaDB service to sync WSREP
|
|
become: true
|
|
command: >-
|
|
{{ kolla_container_engine }} exec {{ mariadb_service.container_name }}
|
|
mysql -uroot -p{{ database_password }}
|
|
--silent --skip-column-names
|
|
-e 'SHOW STATUS LIKE "wsrep_local_state_comment"'
|
|
changed_when: false
|
|
register: result
|
|
until: result.stdout == "wsrep_local_state_comment\tSynced"
|
|
retries: 10
|
|
delay: 6
|
|
no_log: true
|
|
listen: Bootstrap MariaDB cluster
|
|
|
|
- name: Ensure MariaDB is running normally on bootstrap host
|
|
group_by:
|
|
key: mariadb_bootstrap_restart
|
|
listen: Bootstrap MariaDB cluster
|
|
|
|
- name: Restart MariaDB on existing cluster members
|
|
group_by:
|
|
key: mariadb_restart
|
|
when:
|
|
- groups[mariadb_shard_group + '_port_alive_True'] is defined
|
|
- inventory_hostname in groups[mariadb_shard_group + '_port_alive_True']
|
|
- kolla_action != "config"
|
|
listen: restart mariadb
|
|
|
|
- name: Start MariaDB on new nodes
|
|
group_by:
|
|
key: mariadb_start
|
|
when:
|
|
- bootstrap_host is not defined or bootstrap_host != inventory_hostname
|
|
- groups[mariadb_shard_group + '_port_alive_False'] is defined
|
|
- inventory_hostname in groups[mariadb_shard_group + '_port_alive_False']
|
|
- kolla_action != "config"
|
|
listen: restart mariadb
|
|
|
|
- name: Restart mariadb-clustercheck container
|
|
vars:
|
|
service_name: "mariadb-clustercheck"
|
|
service: "{{ mariadb_services[service_name] }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
image: "{{ service.image }}"
|
|
name: "{{ service.container_name }}"
|
|
volumes: "{{ service.volumes }}"
|
|
dimensions: "{{ service.dimensions }}"
|
|
environment: "{{ service.environment }}"
|
|
listen:
|
|
- restart mariadb-clustercheck
|
|
when:
|
|
- kolla_action != "config"
|