mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 17:50:27 +00:00
Merge pull request #154 from scornelissen85/fix/mariadb-datadir
Fix setting datadir to alternate dir with mariadb
This commit is contained in:
commit
36fd044068
1 changed files with 16 additions and 2 deletions
|
@ -91,7 +91,7 @@ mysqld-packages:
|
|||
- require_in:
|
||||
- file: mysql_config
|
||||
|
||||
{% if os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 %}
|
||||
{% if os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.server != 'mariadb-server' %}
|
||||
# Initialize mysql database with --initialize-insecure option before starting service so we don't get locked out.
|
||||
mysql_initialize:
|
||||
cmd.run:
|
||||
|
@ -102,6 +102,18 @@ mysql_initialize:
|
|||
- pkg: {{ mysql.server }}
|
||||
{% endif %}
|
||||
|
||||
{% if os_family in ['RedHat', 'Suse'] and mysql.server == 'mariadb-server' %}
|
||||
# For MariaDB it's enough to only create the datadir
|
||||
mysql_initialize:
|
||||
file.directory:
|
||||
- name: {{ mysql_datadir }}
|
||||
- user: mysql
|
||||
- group: mysql
|
||||
- makedirs: True
|
||||
- require:
|
||||
- pkg: {{ mysql.server }}
|
||||
{% endif %}
|
||||
|
||||
{% if os_family in ['Gentoo'] %}
|
||||
mysql_initialize:
|
||||
cmd.run:
|
||||
|
@ -118,8 +130,10 @@ mysqld:
|
|||
- enable: True
|
||||
- require:
|
||||
- pkg: {{ mysql.server }}
|
||||
{% if (os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7) or (os_family in ['Gentoo']) %}
|
||||
{% if (os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.server != 'mariadb-server') or (os_family in ['Gentoo']) %}
|
||||
- cmd: mysql_initialize
|
||||
{% elif os_family in ['RedHat', 'Suse'] and mysql.server == 'mariadb-server' %}
|
||||
- file: {{ mysql_datadir }}
|
||||
{% endif %}
|
||||
- watch:
|
||||
- pkg: {{ mysql.server }}
|
||||
|
|
Loading…
Add table
Reference in a new issue