summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrakiss <grakiss.wanglei@huawei.com>2016-03-01 20:25:49 -0500
committergrakiss <grakiss.wanglei@huawei.com>2016-03-01 20:25:49 -0500
commit9c35d3a5b192ef2dc4dfd694f1673ce315d47763 (patch)
treef05f1f1cf8fb431c07b1c39f98a59a2b9264997a
parent519706e5c3d5905975a59add1f3c5c4960343227 (diff)
FIX:access denied on centos7 after database cluster being created
JIRA:COMPASS-327 - some unsed user records cause this authority issue - remove these records and restart mysql service Change-Id: I1a0fb6e8bf0690c7163680585d8cac653534ff3f Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
index 2ab10c0d..b18ae8f7 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
@@ -36,3 +36,32 @@
host={{ item }}
state=present
with_items: ['%', 'localhost']
+
+- name: remove unused user
+ script: remove_user.sh
+ when: ansible_os_family == "RedHat"
+
+- name: restart first nodes
+ service:
+ name: mysql
+ state: restarted
+ when: inventory_hostname == haproxy_hosts.keys()[0] and haproxy_hosts|length > 1
+
+- name: wait for cluster ready
+ command: mysql -e"show status like 'wsrep%'"
+ register: cluster_status
+ until: cluster_status|success
+ failed_when: not cluster_status.stdout | search("ON")
+ retries: 10
+ delay: 3
+ when:
+ - inventory_hostname == haproxy_hosts.keys()[0]
+
+- name: restart other nodes
+ service:
+ name: mysql
+ state: restarted
+ enabled: yes
+ when:
+ - inventory_hostname != haproxy_hosts.keys()[0]
+