Skip to content

Commit b0b189a

Browse files
committed
Add documentation on installing MySQL and newer versions on CentOS 7.
1 parent c8695a0 commit b0b189a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,29 @@ The rest of the settings in `defaults/main.yml` control MySQL's memory usage and
107107

108108
Replication settings. Set `mysql_server_id` and `mysql_replication_role` by server (e.g. the master would be ID `1`, with the `mysql_replication_role` of `master`, and the slave would be ID `2`, with the `mysql_replication_role` of `slave`). The `mysql_replication_user` uses the same keys as `mysql_users`, and is created on master servers, and used to replicate on all the slaves.
109109

110+
### Later versions of MySQL on CentOS 7
111+
112+
If you want to install MySQL from the official repository instead of installing the system default MariaDB equivalents, you can add the following `pre_tasks` task in your playbook:
113+
114+
```yaml
115+
pre_tasks:
116+
- name: Install the MySQL repo.
117+
yum:
118+
name: http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
119+
state: present
120+
when: ansible_os_family == "RedHat"
121+
122+
- name: Override variables for MySQL (RedHat).
123+
set_fact:
124+
mysql_daemon: mysqld
125+
mysql_packages: ['mysql-server']
126+
mysql_log_error: /var/log/mysqld.err
127+
mysql_syslog_tag: mysqld
128+
mysql_pid_file: /var/run/mysqld/mysqld.pid
129+
mysql_socket: /var/lib/mysql/mysql.sock
130+
when: ansible_os_family == "RedHat"
131+
```
132+
110133
### MariaDB usage
111134
112135
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.

0 commit comments

Comments
 (0)