Merge pull request #116 from geerlingguy/dglaser-master

Support MariaDB in RHEL 7 out of the box
pull/63/head
Jeff Geerling 8 years ago
commit f94f3a6bed
  1. 21
      README.md
  2. 9
      tasks/configure.yml
  3. 7
      tasks/main.yml
  4. 2
      tests/Dockerfile.centos-6
  5. 2
      tests/Dockerfile.centos-7
  6. 0
      vars/RedHat-6.yml
  7. 15
      vars/RedHat-7.yml

@ -97,26 +97,11 @@ Replication settings. Set `mysql_server_id` and `mysql_replication_role` by serv
### MariaDB usage
This role works with either MySQL or a compatible version of MariaDB. On RHEL/CentOS 7+, the mariadb database engine was substituted as the default MySQL replacement package, so you should override the `mysql_packages` variable with the below configuration to make sure MariaDB is installed correctly.
This role works with either MySQL or a compatible version of MariaDB. On RHEL/CentOS 7+, the mariadb database engine was substituted as the default MySQL replacement package. No modifications are necessary though all of the variables still reference 'mysql' instead of mariadb.
#### RHEL/CentOS 7 MariaDB configuration
#### Ubuntu 14.04 and 16.04 MariaDB configuration
Set the following variables (at a minimum):
mysql_packages:
- mariadb
- mariadb-server
- mariadb-libs
- MySQL-python
- perl-DBD-MySQL
mysql_daemon: mariadb
mysql_log_error: /var/log/mariadb/mariadb.log
mysql_syslog_tag: mariadb
mysql_pid_file: /var/run/mariadb/mariadb.pid
#### Ubuntu 14.04 MariaDB configuration
Set the following variables (at a minimum):
On Ubuntu, the package names are named differently, so the `mysql_package` variable needs to be altered. Set the following variables (at a minimum):
mysql_packages:
- mariadb-client

@ -33,6 +33,15 @@
shell: "touch {{ mysql_slow_query_log_file }} creates={{ mysql_slow_query_log_file }}"
when: mysql_slow_query_log_enabled
- name: Create datadir if it does not exist
file:
path: "{{ mysql_datadir }}"
state: directory
owner: mysql
group: mysql
mode: 0755
setype: mysqld_db_t
- name: Set ownership on slow query log file (if configured).
file:
path: "{{ mysql_slow_query_log_file }}"

@ -1,7 +1,12 @@
---
# Include variables and define needed variables.
# Variable configuration.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
when: ansible_os_family != "RedHat"
- name: Include OS-specific variables (RedHat).
include_vars: "{{ ansible_os_family }}-{{ ansible_lsb.major_release }}.yml"
when: ansible_os_family == "RedHat"
- name: Define mysql_packages.
set_fact:

@ -1,5 +1,7 @@
FROM centos:6
RUN yum -y install redhat-lsb-core
# Install Ansible
RUN yum -y update; yum clean all;
RUN yum -y install epel-release

@ -12,6 +12,8 @@ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*; \
rm -f /lib/systemd/system/anaconda.target.wants/*;
RUN yum -y install redhat-lsb-core
# Install Ansible
RUN yum -y install epel-release
RUN yum -y install git ansible sudo

@ -0,0 +1,15 @@
---
__mysql_daemon: mariadb
__mysql_packages:
- mariadb
- mariadb-server
- mariadb-libs
- MySQL-python
- perl-DBD-MySQL
__mysql_slow_query_log_file: /var/log/mysql-slow.log
mysql_log_error: /var/log/mariadb/mariadb.log
mysql_syslog_tag: mariadb
mysql_pid_file: /var/run/mariadb/mariadb.pid
mysql_config_file: /etc/my.cnf
mysql_config_include_dir: /etc/my.cnf.d
mysql_socket: /var/lib/mysql/mysql.sock