From 8a206699d4d2e550963a7b7be38fc8281075133c Mon Sep 17 00:00:00 2001
From: LinPeiWen <591171850@qq.com>
Date: Tue, 24 Mar 2020 23:46:18 -0400
Subject: [PATCH] mariadb container name variable

mariadb container name variable is fixed in some places,
but in the defaults directory, mariadb container_name variable
is variable. If the mariadb container_name variable is changed
during deployment, it will not be assigned to container_name,
but a fixed 'mariadb' name.

Change-Id: Ie8efa509953d5efa5c3073c9b550be051a7f4f9b
---
 ansible/roles/mariadb/tasks/check.yml           | 2 +-
 ansible/roles/mariadb/tasks/recover_cluster.yml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/mariadb/tasks/check.yml b/ansible/roles/mariadb/tasks/check.yml
index 66c5299e8..69f5e032d 100644
--- a/ansible/roles/mariadb/tasks/check.yml
+++ b/ansible/roles/mariadb/tasks/check.yml
@@ -1,7 +1,7 @@
 ---
 - name: Waiting for MariaDB service to be ready through VIP
   become: true
-  command: "docker exec mariadb mysql -h {{ database_address }} -P {{ database_port }} -u haproxy -e 'show databases;'"
+  command: "docker exec {{ mariadb_service.container_name }} mysql -h {{ database_address }} -P {{ database_port }} -u haproxy -e 'show databases;'"
   register: result
   until: result is success
   changed_when: False
diff --git a/ansible/roles/mariadb/tasks/recover_cluster.yml b/ansible/roles/mariadb/tasks/recover_cluster.yml
index c9f24a10d..2147d9819 100644
--- a/ansible/roles/mariadb/tasks/recover_cluster.yml
+++ b/ansible/roles/mariadb/tasks/recover_cluster.yml
@@ -121,7 +121,7 @@
 
 - name: Copying grastate.dat file to mariadb container
   become: true
-  command: docker cp /tmp/kolla_mariadb_grastate.dat mariadb:/var/lib/mysql/grastate.dat
+  command: docker cp /tmp/kolla_mariadb_grastate.dat {{ mariadb_service.container_name }}:/var/lib/mysql/grastate.dat
   changed_when: false
   when:
     - bootstrap_host is defined
-- 
GitLab