mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 09:40:26 +00:00
Merge pull request #263 from bawuenet/master
refactor(jinja): improve indentation
This commit is contained in:
commit
8fc2b0344f
1 changed files with 51 additions and 47 deletions
|
@ -14,31 +14,32 @@ include:
|
||||||
{%- set mysql_datadir = salt['pillar.get']('mysql:server:mysqld:datadir', '/var/lib/mysql') %}
|
{%- set mysql_datadir = salt['pillar.get']('mysql:server:mysqld:datadir', '/var/lib/mysql') %}
|
||||||
{%- set mysql_unix_socket = salt['pillar.get']('mysql:server:unix_socket', '') %}
|
{%- set mysql_unix_socket = salt['pillar.get']('mysql:server:unix_socket', '') %}
|
||||||
{%- set lsb_distrib_codename = salt['grains.get']('lsb_distrib_codename', None) %}
|
{%- set lsb_distrib_codename = salt['grains.get']('lsb_distrib_codename', None) %}
|
||||||
|
|
||||||
{%- if mysql_root_password %}
|
{%- if mysql_root_password %}
|
||||||
{%- if os_family == 'Debian' %}
|
{%- if os_family == 'Debian' %}
|
||||||
|
|
||||||
{% if 'debconf_root_password' in mysql %}
|
{%- if 'debconf_root_password' in mysql %}
|
||||||
{% set debconf_root_password = mysql.debconf_root_password %}
|
{%- set debconf_root_password = mysql.debconf_root_password %}
|
||||||
{% set debconf_root_password_again = mysql.debconf_root_password_again %}
|
{%- set debconf_root_password_again = mysql.debconf_root_password_again %}
|
||||||
{% elif mysql.serverpkg.startswith('percona-server-server') %}
|
{%- elif mysql.serverpkg.startswith('percona-server-server') %}
|
||||||
{% if mysql.serverpkg < 'percona-server-server-5.7' %}{# 5.5 and 5.6 uses the same name... #}
|
{%- if mysql.serverpkg < 'percona-server-server-5.7' %}{# 5.5 and 5.6 uses the same name... #}
|
||||||
{% set debconf_root_password = 'percona-server-server/root_password' %}
|
{%- set debconf_root_password = 'percona-server-server/root_password' %}
|
||||||
{% set debconf_root_password_again = 'percona-server-server/root_password_again' %}
|
{%- set debconf_root_password_again = 'percona-server-server/root_password_again' %}
|
||||||
{% elif '5.7' in mysql.serverpkg %}{# 5.7 changed option name... #}
|
{%- elif '5.7' in mysql.serverpkg %}{# 5.7 changed option name... #}
|
||||||
{% set debconf_root_password = 'percona-server-server-5.7/root-pass' %}
|
{%- set debconf_root_password = 'percona-server-server-5.7/root-pass' %}
|
||||||
{% set debconf_root_password_again = 'percona-server-server-5.7/re-root-pass' %}
|
{%- set debconf_root_password_again = 'percona-server-server-5.7/re-root-pass' %}
|
||||||
{% else %}{# attempt to support future version? #}
|
{%- else %}{# attempt to support future version? #}
|
||||||
{% set debconf_root_password = mysql.serverpkg + '/root-pass' %}
|
{%- set debconf_root_password = mysql.serverpkg + '/root-pass' %}
|
||||||
{% set debconf_root_password_again = mysql.serverpkg + '/re-root-pass' %}
|
{%- set debconf_root_password_again = mysql.serverpkg + '/re-root-pass' %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% else %}
|
{%- else %}
|
||||||
{% if salt['grains.get']('osmajorrelease')|int < 9 or not salt['grains.get']('os')|lower == 'debian' %}
|
{%- if salt['grains.get']('osmajorrelease')|int < 9 or not salt['grains.get']('os')|lower == 'debian' %}
|
||||||
{% set debconf_root_password = 'mysql-server/root_password' %}
|
{%- set debconf_root_password = 'mysql-server/root_password' %}
|
||||||
{% set debconf_root_password_again = 'mysql-server/root_password_again' %}
|
{%- set debconf_root_password_again = 'mysql-server/root_password_again' %}
|
||||||
{% else %}
|
{%- else %}
|
||||||
{% set debconf_root_password = False %}
|
{%- set debconf_root_password = False %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% if mysql.serverpkg == 'mysql-community-server' %}
|
{% if mysql.serverpkg == 'mysql-community-server' %}
|
||||||
mysql-community-server_repo:
|
mysql-community-server_repo:
|
||||||
|
@ -65,8 +66,8 @@ mysql_debconf:
|
||||||
- require:
|
- require:
|
||||||
- pkg: mysql_debconf_utils
|
- pkg: mysql_debconf_utils
|
||||||
|
|
||||||
{%- if debconf_root_password %}
|
{%- if debconf_root_password %}
|
||||||
{% if mysql.serverpkg == 'mysql-community-server' %}
|
{% if mysql.serverpkg == 'mysql-community-server' %}
|
||||||
mysql_password_debconf:
|
mysql_password_debconf:
|
||||||
debconf.set:
|
debconf.set:
|
||||||
- name: 'mysql-community-server'
|
- name: 'mysql-community-server'
|
||||||
|
@ -78,7 +79,7 @@ mysql_password_debconf:
|
||||||
- pkg: {{ mysql.serverpkg }}
|
- pkg: {{ mysql.serverpkg }}
|
||||||
- require:
|
- require:
|
||||||
- pkg: mysql_debconf_utils
|
- pkg: mysql_debconf_utils
|
||||||
{% else %}
|
{% else %}
|
||||||
mysql_password_debconf:
|
mysql_password_debconf:
|
||||||
debconf.set:
|
debconf.set:
|
||||||
- name: mysql-server
|
- name: mysql-server
|
||||||
|
@ -91,7 +92,7 @@ mysql_password_debconf:
|
||||||
- pkg: mysql_debconf_utils
|
- pkg: mysql_debconf_utils
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- elif os_family in ['RedHat', 'Suse', 'FreeBSD'] %}
|
{%- elif os_family in ['RedHat', 'Suse', 'FreeBSD'] %}
|
||||||
mysql_root_password:
|
mysql_root_password:
|
||||||
|
@ -109,22 +110,22 @@ mysql_delete_anonymous_user_{{ host }}:
|
||||||
- name: ''
|
- name: ''
|
||||||
- connection_host: '{{ mysql_host }}'
|
- connection_host: '{{ mysql_host }}'
|
||||||
- connection_user: '{{ mysql_salt_user }}'
|
- connection_user: '{{ mysql_salt_user }}'
|
||||||
{%- if mysql_salt_password %}
|
{%- if mysql_salt_password %}
|
||||||
- connection_pass: '{{ mysql_salt_password }}'
|
- connection_pass: '{{ mysql_salt_password }}'
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if mysql_unix_socket %}
|
{%- if mysql_unix_socket %}
|
||||||
- connection_unix_socket: '{{ mysql_unix_socket }}'
|
- connection_unix_socket: '{{ mysql_unix_socket }}'
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
- connection_charset: utf8
|
- connection_charset: utf8
|
||||||
- require:
|
- require:
|
||||||
- service: mysqld-service-running
|
- service: mysqld-service-running
|
||||||
- pkg: mysql_python
|
- pkg: mysql_python
|
||||||
{%- if (mysql_salt_user == mysql_root_user) and mysql_root_password %}
|
{%- if (mysql_salt_user == mysql_root_user) and mysql_root_password %}
|
||||||
- cmd: mysql_root_password
|
- cmd: mysql_root_password
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if (mysql_salt_user != mysql_root_user) %}
|
{%- if (mysql_salt_user != mysql_root_user) %}
|
||||||
- sls: mysql.salt-user
|
- sls: mysql.salt-user
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -162,7 +163,8 @@ mysqld-packages:
|
||||||
- file: mysql_config_directory
|
- file: mysql_config_directory
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- if os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server' %}
|
{%- if os_family in ['RedHat', 'Suse'] and mysql.version is defined
|
||||||
|
and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server' %}
|
||||||
# Initialize mysql database with --initialize-insecure option before starting service so we don't get locked out.
|
# Initialize mysql database with --initialize-insecure option before starting service so we don't get locked out.
|
||||||
mysql_initialize:
|
mysql_initialize:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
|
@ -217,7 +219,9 @@ mysqld-service-running:
|
||||||
- enable: True
|
- enable: True
|
||||||
- require:
|
- require:
|
||||||
- pkg: {{ mysql.serverpkg }}
|
- pkg: {{ mysql.serverpkg }}
|
||||||
{%- if (os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server') or (os_family in ['Gentoo', 'FreeBSD']) %}
|
{%- if (os_family in ['RedHat', 'Suse'] and mysql.version is defined
|
||||||
|
and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server')
|
||||||
|
or (os_family in ['Gentoo', 'FreeBSD']) %}
|
||||||
- cmd: mysql_initialize
|
- cmd: mysql_initialize
|
||||||
{%- elif os_family in ['RedHat', 'Suse'] and mysql.serverpkg.lower() == 'mariadb-server' %}
|
{%- elif os_family in ['RedHat', 'Suse'] and mysql.serverpkg.lower() == 'mariadb-server' %}
|
||||||
- file: {{ mysql_datadir }}
|
- file: {{ mysql_datadir }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue