
Add support for the openSUSE Leap distributions. For openSUSE we use the packages provided by the Open Build Service repository which contains the Galera clustering support. These packages are different compared to the CentOS7 and Ubuntu ones so the way the cluster is being bootstrapped is also different. The systemd service file can't be used for that, so we need to modify the MariaDB configuration file on the boostrap node to initiate the cluster. Moreover, files are installed in different places so we need to modify the distribution files and templates to take that into consideration as well. Change-Id: I1ac31fbc06152da7f93e57911d4a952f0dd83849
129 lines
3.7 KiB
YAML
129 lines
3.7 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Create the local directories
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: "directory"
|
|
owner: "{{ item.owner|default('root') }}"
|
|
group: "{{ item.group|default('root') }}"
|
|
mode: "{{ item.mode|default('0755') }}"
|
|
recurse: "{{ item.recurse|default('false') }}"
|
|
with_items:
|
|
- { path: "/var/lib/mysql", owner: "mysql", mode: "2755" }
|
|
- { path: "/var/log/mysql", owner: "mysql", mode: "2755" }
|
|
- { path: "/var/log/mysql_logs", owner: "mysql", mode: "2755" }
|
|
- { path: "/etc/mysql/conf.d" }
|
|
tags:
|
|
- galera-config
|
|
|
|
- include: galera_ssl.yml
|
|
when:
|
|
- galera_use_ssl | bool
|
|
tags:
|
|
- galera-config
|
|
- galera-ssl
|
|
|
|
- name: Drop mariadb config(s)
|
|
config_template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0644"
|
|
config_overrides: "{{ item.config_overrides }}"
|
|
config_type: "{{ item.config_type }}"
|
|
with_items:
|
|
- src: my.cnf.j2
|
|
dest: "{{ galera_etc_conf_file }}"
|
|
config_overrides: "{{ galera_my_cnf_overrides }}"
|
|
config_type: "ini"
|
|
- src: cluster.cnf.j2
|
|
dest: "{{ galera_etc_include_dir }}/cluster.cnf"
|
|
config_overrides: "{{ galera_cluster_cnf_overrides }}"
|
|
config_type: "ini"
|
|
- src: debian.cnf.j2
|
|
dest: /etc/mysql/debian.cnf
|
|
config_overrides: "{{ galera_debian_cnf_overrides }}"
|
|
config_type: "ini"
|
|
notify: Restart all mysql
|
|
tags:
|
|
- galera-config
|
|
- galera-client-user-config
|
|
|
|
# NOTE: (mancdaz) this should not be needed with mariadb-10.1 since its
|
|
# initscript sources /etc/default/mariadb
|
|
- name: fix mysql startup timeout
|
|
lineinfile:
|
|
dest: /etc/init.d/mysql
|
|
state: present
|
|
insertafter: '^export HOME=/etc/mysql/'
|
|
line: '[ -r /etc/default/mariadb ] && . /etc/default/mariadb'
|
|
backup: yes
|
|
when: ansible_pkg_mgr != 'zypper'
|
|
tags:
|
|
- galera-config
|
|
|
|
- name: Apply service defaults
|
|
template:
|
|
src: "mysql_defaults.j2"
|
|
dest: "/etc/default/mariadb"
|
|
mode: "0644"
|
|
when: ansible_pkg_mgr != 'zypper'
|
|
notify:
|
|
- Restart all mysql
|
|
- Reload the systemd daemon
|
|
tags:
|
|
- galera-config
|
|
|
|
- name: Create mariadb systemd service config dir
|
|
file:
|
|
path: "/etc/systemd/system/{{ galera_mariadb_service_name }}.service.d"
|
|
state: "directory"
|
|
group: "root"
|
|
owner: "root"
|
|
mode: "0755"
|
|
when:
|
|
- ansible_service_mgr == 'systemd'
|
|
|
|
- name: Apply systemd options
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "/etc/systemd/system/{{ galera_mariadb_service_name }}.service.d/{{ item.dest }}"
|
|
mode: "0644"
|
|
with_items:
|
|
- { src: "systemd.limits.conf.j2", dest: "limits.conf" }
|
|
- { src: "systemd.timeout.conf.j2", dest: "timeout.conf" }
|
|
- { src: "systemd.restart.conf.j2", dest: "restart.conf" }
|
|
when:
|
|
- ansible_service_mgr == 'systemd'
|
|
notify:
|
|
- Reload the systemd daemon
|
|
- Restart all mysql
|
|
tags:
|
|
- galera-config
|
|
|
|
- name: remove default mysql_safe_syslog
|
|
file:
|
|
path: "/etc/mysql/conf.d/mysqld_safe_syslog.cnf"
|
|
state: absent
|
|
tags:
|
|
- galera-config
|
|
|
|
- name: Reload the systemd daemon
|
|
command: "systemctl daemon-reload"
|
|
when:
|
|
- ansible_service_mgr == 'systemd'
|