mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 01:30:25 +00:00
Merge pull request #212 from waynegemmell/add-mysql-community-package
Support for official mysql 8 packages
This commit is contained in:
commit
b2821d5f67
2 changed files with 41 additions and 16 deletions
|
@ -20,8 +20,6 @@ Debian:
|
|||
max_allowed_packet: 16M
|
||||
thread_stack: 192K
|
||||
thread_cache_size: 8
|
||||
query_cache_limit: 1M
|
||||
query_cache_size: 16M
|
||||
expire_logs_days: 10
|
||||
max_binlog_size: 100M
|
||||
# innodb_flush_log_at_trx_commit: 1
|
||||
|
|
|
@ -2,19 +2,32 @@ include:
|
|||
- .config
|
||||
- .python
|
||||
|
||||
{%- from tpldir ~ "/map.jinja" import mysql with context %}
|
||||
{% from tpldir ~ "/map.jinja" import mysql with context %}
|
||||
|
||||
{%- set os = salt['grains.get']('os', None) %}
|
||||
{%- set os_family = salt['grains.get']('os_family', None) %}
|
||||
{%- set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %}
|
||||
{%- set mysql_root_password = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %}
|
||||
{%- set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %}
|
||||
{%- set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %}
|
||||
{%- set mysql_salt_password = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_password) %}
|
||||
{%- set mysql_datadir = salt['pillar.get']('mysql:server:mysqld:datadir', '/var/lib/mysql') %}
|
||||
|
||||
{%- if mysql_root_password %}
|
||||
{%- if os_family == 'Debian' %}
|
||||
{% set os = salt['grains.get']('os', None) %}
|
||||
{% set os_family = salt['grains.get']('os_family', None) %}
|
||||
{% set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %}
|
||||
{% set mysql_root_password = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %}
|
||||
{% set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %}
|
||||
{% set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %}
|
||||
{% set mysql_salt_password = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_password) %}
|
||||
{% set mysql_datadir = salt['pillar.get']('mysql:server:mysqld:datadir', '/var/lib/mysql') %}
|
||||
{% set lsb_distrib_codename = salt['grains.get']('lsb_distrib_codename', None) %}
|
||||
{% if mysql_root_password %}
|
||||
{% if os_family == 'Debian' %}
|
||||
|
||||
{% if mysql.serverpkg == 'mysql-community-server' %}
|
||||
mysql-community-server_repo:
|
||||
pkgrepo.managed:
|
||||
- humanname: "Mysql official repo"
|
||||
- name: deb http://repo.mysql.com/apt/ubuntu/ {{ lsb_distrib_codename }} mysql-8.0
|
||||
- file: /etc/apt/sources.list.d/mysql.list
|
||||
- refresh: True
|
||||
- require_in:
|
||||
- pkg: mysql-community-server
|
||||
{% endif %}
|
||||
|
||||
mysql_debconf_utils:
|
||||
pkg.installed:
|
||||
- name: {{ mysql.debconf_utils }}
|
||||
|
@ -31,18 +44,32 @@ mysql_debconf:
|
|||
|
||||
{%- if 'osmajorrelease' in grains and salt['grains.get']('osmajorrelease')|int < 9 or not salt['grains.get']('os')|lower == 'debian' %}
|
||||
|
||||
{% if mysql.serverpkg == 'mysql-community-server' %}
|
||||
mysql_password_debconf:
|
||||
debconf.set:
|
||||
- name: 'mysql-community-server'
|
||||
- data:
|
||||
'mysql-community-server/root-pass': {'type': 'password', 'value': '{{ mysql_root_password }}'}
|
||||
'mysql-community-server/re-root-pass': {'type': 'password', 'value': '{{ mysql_root_password }}'}
|
||||
'mysql-server/default-auth-override': {'type': 'string', 'value':'Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)'}
|
||||
- require_in:
|
||||
- pkg: {{ mysql.serverpkg }}
|
||||
- require:
|
||||
- pkg: mysql_debconf_utils
|
||||
{% else %}
|
||||
mysql_password_debconf:
|
||||
debconf.set:
|
||||
- name: mysql-server
|
||||
- data:
|
||||
'mysql-server/root_password': {'type': 'password', 'value': '{{ mysql_root_password }}'}
|
||||
'mysql-server/root_password_again': {'type': 'password', 'value': '{{ mysql_root_password }}'}
|
||||
'{{ mysql.serverpkg }}/root_password': {'type': 'password', 'value': '{{ mysql_root_password }}'}
|
||||
'{{ mysql.serverpkg }}/root_password_again': {'type': 'password', 'value': '{{ mysql_root_password }}'}
|
||||
- require_in:
|
||||
- pkg: {{ mysql.serverpkg }}
|
||||
- require:
|
||||
- pkg: mysql_debconf_utils
|
||||
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{%- elif os_family in ['RedHat', 'Suse', 'FreeBSD'] %}
|
||||
mysql_root_password:
|
||||
|
|
Loading…
Add table
Reference in a new issue