summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/database
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/database')
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/main.yml4
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb.yml20
-rw-r--r--deploy/adapters/ansible/roles/database/templates/wsrep.cnf4
-rw-r--r--deploy/adapters/ansible/roles/database/vars/Debian.yml5
-rw-r--r--deploy/adapters/ansible/roles/database/vars/RedHat.yml2
5 files changed, 25 insertions, 10 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
diff --git a/deploy/adapters/ansible/roles/database/templates/wsrep.cnf b/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
index 81699796..6c14b155 100644
--- a/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
+++ b/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
@@ -48,7 +48,7 @@ wsrep_provider={{ wsrep_provider_file }}
wsrep_cluster_name="my_wsrep_cluster"
# Group communication system handle
-wsrep_cluster_address=gcomm://{{ HA_CLUSTER[inventory_hostname] }}
+wsrep_cluster_address=gcomm://{{ haproxy_hosts.values()|join(",") }}
# Human-readable node name (non-unique). Hostname by default.
#wsrep_node_name=
@@ -56,7 +56,7 @@ wsrep_cluster_address=gcomm://{{ HA_CLUSTER[inventory_hostname] }}
# Base replication <address|hostname>[:port] of the node.
# The values supplied will be used as defaults for state transfer receiving,
# listening ports and so on. Default: address of the first network interface.
-wsrep_node_address={{ hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}
+wsrep_node_address={{ internal_ips[inventory_hostname] }}
# Address for incoming client connections. Autodetect by default.
#wsrep_node_incoming_address=
diff --git a/deploy/adapters/ansible/roles/database/vars/Debian.yml b/deploy/adapters/ansible/roles/database/vars/Debian.yml
index 79f7008c..15657d58 100644
--- a/deploy/adapters/ansible/roles/database/vars/Debian.yml
+++ b/deploy/adapters/ansible/roles/database/vars/Debian.yml
@@ -7,10 +7,9 @@ mysql_packages:
maridb_packages:
- libaio1
- libssl0.9.8
- - mysql-client-5.5
- python-mysqldb
- - mysql-wsrep-server
- - galera
+ - mysql-wsrep-server-5.5
+ - galera-3
services: []
diff --git a/deploy/adapters/ansible/roles/database/vars/RedHat.yml b/deploy/adapters/ansible/roles/database/vars/RedHat.yml
index 1e4b427a..12eedf51 100644
--- a/deploy/adapters/ansible/roles/database/vars/RedHat.yml
+++ b/deploy/adapters/ansible/roles/database/vars/RedHat.yml
@@ -4,8 +4,8 @@ mysql_packages:
- mysql-server
maridb_packages:
+ - MariaDB-Galera-server
- MariaDB-client
- - MariaDB-server
- galera
services: []