mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-17 10:10:30 +00:00
Check for MySQL 5.7 and act appropriately on Redhat/Arch
This commit is contained in:
parent
59fd786975
commit
ff728b2d22
1 changed files with 19 additions and 1 deletions
|
@ -64,13 +64,17 @@ mysql_delete_anonymous_user_{{ host }}:
|
||||||
# on arch linux: inital mysql datadirectory is not created
|
# on arch linux: inital mysql datadirectory is not created
|
||||||
mysql_install_datadir:
|
mysql_install_datadir:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
|
{% if pkg.version >= 5.7 %}
|
||||||
|
- name: mysqld --initialize-insecure --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
||||||
|
{% else %}
|
||||||
- name: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
- name: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
||||||
|
{% endif %}
|
||||||
- user: root
|
- user: root
|
||||||
- creates: /var/lib/mysql/mysql/user.frm
|
- creates: /var/lib/mysql/mysql/user.frm
|
||||||
- env:
|
- env:
|
||||||
- TMPDIR: '/tmp'
|
- TMPDIR: '/tmp'
|
||||||
- require:
|
- require:
|
||||||
- pkg: {{ mysql.server }}
|
- pkg: {{ mysql.server }}
|
||||||
- file: mysql_config
|
- file: mysql_config
|
||||||
- require_in:
|
- require_in:
|
||||||
- service: mysqld
|
- service: mysqld
|
||||||
|
@ -84,12 +88,26 @@ mysqld-packages:
|
||||||
- debconf: mysql_debconf
|
- debconf: mysql_debconf
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if os_family == 'RedHat' or 'Suse' and pkg.version >= 5.7 %}
|
||||||
|
# Initialize mysql database with --initialize-insecure option before starting service so we don't get locked out.
|
||||||
|
mysql_initialize:
|
||||||
|
cmd.run:
|
||||||
|
- name: mysqld --initialize-insecure --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
||||||
|
- user: root
|
||||||
|
- creates: /var/lib/mysql/mysql/
|
||||||
|
- require:
|
||||||
|
- pkg: {{ mysql.server }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
mysqld:
|
mysqld:
|
||||||
service.running:
|
service.running:
|
||||||
- name: {{ mysql.service }}
|
- name: {{ mysql.service }}
|
||||||
- enable: True
|
- enable: True
|
||||||
- require:
|
- require:
|
||||||
- pkg: {{ mysql.server }}
|
- pkg: {{ mysql.server }}
|
||||||
|
{% if os_family == 'RedHat' or 'Suse' and pkg.version >= 5.7 %}
|
||||||
|
- cmd: mysql_initialize
|
||||||
|
{% endif %}
|
||||||
- watch:
|
- watch:
|
||||||
- pkg: {{ mysql.server }}
|
- pkg: {{ mysql.server }}
|
||||||
- file: mysql_config
|
- file: mysql_config
|
||||||
|
|
Loading…
Add table
Reference in a new issue