summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/database/tasks
diff options
context:
space:
mode:
authoryour name <email@163.com>2015-09-09 03:26:11 -0400
committeryour name <email@163.com>2015-09-09 03:26:11 -0400
commit72039e915d1fc960bd0d7fccd910ea282d61bee7 (patch)
tree60452129b1b9f3c3419b4a29a038f5f0cbade5f7 /deploy/adapters/ansible/roles/database/tasks
parentcf87d3067a63cb8be315a3addfd9c27d86be3b5a (diff)
Compass Netconfig optimization
Change-Id: Icbcfc7d794623436f22be5f6763b212a25d4fac7 JIRA: COMPASS-30
Diffstat (limited to 'deploy/adapters/ansible/roles/database/tasks')
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/main.yml4
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb.yml20
2 files changed, 20 insertions, 4 deletions
diff --git a/deploy/adapters/ansible/roles/database/tasks/main.yml b/deploy/adapters/ansible/roles/database/tasks/main.yml
index 05697730..71916751 100644
--- a/deploy/adapters/ansible/roles/database/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/main.yml
@@ -7,8 +7,8 @@
- mysql_user
- include: mysql.yml
- when: HA_CLUSTER is not defined
+ when: haproxy_hosts is not defined
- include: mariadb.yml
- when: HA_CLUSTER is defined
+ when: haproxy_hosts is defined
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
index dbd76c68..3626777b 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
@@ -1,4 +1,9 @@
---
+#- name: delete default maridb-libs
+# action: "{{ ansible_pkg_mgr }} name=mariadb-libs state=absent"
+# when: ansible_os_family == "RedHat"
+# ignore_errors: True
+
- name: install python-mysqldb
action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
with_items: maridb_packages | union(packages_noarch)
@@ -19,8 +24,19 @@
- name: update wsrep_sst_rsync gid
lineinfile: dest=/usr/bin/wsrep_sst_rsync state=absent regexp="\s*gid = \$MYGID$" backup=yes
-- name: manually restart mysql server
+- name: restart first mysql server
+ shell: service mysql restart --wsrep-cluster-address="gcomm://"
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+ register: result
+ until: result|success
+ retries: 5
+ delay: 5
+ tags:
+ - mysql_restart
+
+- name: restart other mysql server
service: name=mysql state=restarted enabled=yes
+ when: inventory_hostname != haproxy_hosts.keys()[0]
register: result
until: result|success
retries: 5
@@ -34,6 +50,6 @@
- name: create database/user
shell: /opt/data.sh
- when: HA_CLUSTER[inventory_hostname] == ''
+ run_once: True
tags:
- mysql_user