910f9bd36f
First part of patchset: https://review.opendev.org/c/openstack/kolla-ansible/+/799229/ in which was suggested to split patch into smaller ones. This implements kolla_container_engine variable in command calls of docker,so later on it can be also used for podman without further change. Signed-off-by: Ivan Halomi <i.halomi@partner.samsung.com> Change-Id: Ic30b67daa2e215524096ad1f4385c569e3d41b95
49 lines
1.6 KiB
YAML
49 lines
1.6 KiB
YAML
---
|
|
- name: Restart MariaDB container
|
|
vars:
|
|
service_name: "mariadb"
|
|
service: "{{ mariadb_services[service_name] }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
volumes: "{{ service.volumes }}"
|
|
dimensions: "{{ service.dimensions }}"
|
|
environment: "{{ service.environment | default(omit) }}"
|
|
healthcheck: "{{ service.healthcheck | default(omit) }}"
|
|
|
|
# NOTE(yoctozepto): We have to loop this to avoid breaking on connection resets
|
|
- name: Wait for 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
|
|
|
|
- name: Wait for 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
|
|
when:
|
|
# NOTE(yoctozepto): we don't want to wait for new nodes to fully sync
|
|
# with an existing cluster as this could take time
|
|
- not mariadb_cluster_exists or
|
|
(groups[mariadb_shard_group + '_port_alive_True'] is defined and
|
|
inventory_hostname in groups[mariadb_shard_group + '_port_alive_True'])
|