mirror of
https://github.com/aljazceru/ansible-role-mysql.git
synced 2025-12-19 18:24:21 +01:00
Merge branch 'master' of git://github.com/dsglaser/ansible-role-mysql into dglaser-master
This commit is contained in:
18
README.md
18
README.md
@@ -97,25 +97,13 @@ Replication settings. Set `mysql_server_id` and `mysql_replication_role` by serv
|
|||||||
|
|
||||||
### MariaDB usage
|
### 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
|
|
||||||
|
|
||||||
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
|
#### Ubuntu 14.04 MariaDB configuration
|
||||||
|
|
||||||
|
On Ubuntu, the package names are named differently, so the `mysql_package` variabl needs to be altered
|
||||||
|
|
||||||
Set the following variables (at a minimum):
|
Set the following variables (at a minimum):
|
||||||
|
|
||||||
mysql_packages:
|
mysql_packages:
|
||||||
|
|||||||
@@ -33,6 +33,19 @@
|
|||||||
shell: "touch {{ mysql_slow_query_log_file }} creates={{ mysql_slow_query_log_file }}"
|
shell: "touch {{ mysql_slow_query_log_file }} creates={{ mysql_slow_query_log_file }}"
|
||||||
when: mysql_slow_query_log_enabled
|
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
|
||||||
|
|
||||||
|
- name: Set selinux context on datadir
|
||||||
|
file:
|
||||||
|
path: "{{ mysql_datadir }}"
|
||||||
|
setype: mysqld_db_t
|
||||||
|
|
||||||
- name: Set ownership on slow query log file (if configured).
|
- name: Set ownership on slow query log file (if configured).
|
||||||
file:
|
file:
|
||||||
path: "{{ mysql_slow_query_log_file }}"
|
path: "{{ mysql_slow_query_log_file }}"
|
||||||
|
|||||||
@@ -2,6 +2,17 @@
|
|||||||
# Include variables and define needed variables.
|
# Include variables and define needed variables.
|
||||||
- name: Include OS-specific variables.
|
- name: Include OS-specific variables.
|
||||||
include_vars: "{{ ansible_os_family }}.yml"
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
|
when: ansible_os_family != "RedHat"
|
||||||
|
|
||||||
|
# Include RedHat 6 variables (mysql)
|
||||||
|
- name: Include OS-specific variables.
|
||||||
|
include_vars: "{{ ansible_os_family }}-{{ ansible_lsb.major_release }}.yml"
|
||||||
|
when: ansible_lsb.major_release < "7"
|
||||||
|
|
||||||
|
# Include RedHat 7 variables (mariadb)
|
||||||
|
- name: Include OS-specific variables.
|
||||||
|
include_vars: "{{ ansible_os_family }}-{{ ansible_lsb.major_release }}.yml"
|
||||||
|
when: ansible_os_family >= "7"
|
||||||
|
|
||||||
- name: Define mysql_packages.
|
- name: Define mysql_packages.
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|||||||
15
vars/RedHat-7.yml
Normal file
15
vars/RedHat-7.yml
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user