summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshuai chen <chenshuai@huawei.com>2016-03-02 03:34:33 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-03-02 03:34:33 +0000
commiteb4981a928c1af044ba9a1a9043a40b6a5a45ec0 (patch)
tree8a278d115d135f1ff32e57f684e717750f3ca6ed
parente34f5c3a2900141a6ba67351a1260cd83c531160 (diff)
parent9c35d3a5b192ef2dc4dfd694f1673ce315d47763 (diff)
Merge "FIX:access denied on centos7 after database cluster being created"
-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]
+