mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 17:50:27 +00:00
Merge pull request #122 from moje-skoly/master
Fixed formula on Debian where mysql_root_password state is not present.
This commit is contained in:
commit
07ab6881e2
2 changed files with 14 additions and 2 deletions
|
@ -28,8 +28,10 @@ mysql_salt_user_with_salt_user:
|
|||
- onlyif:
|
||||
- mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -h {{ mysql_host }} --execute="SELECT 1;"
|
||||
- VALUE=$(mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'Y' ]; then /bin/true; else /bin/false; fi
|
||||
{% if os_family in ['RedHat', 'Suse'] %}
|
||||
- require_in:
|
||||
- mysql_user: mysql_root_password
|
||||
{% endif %}
|
||||
|
||||
{%- if mysql_salt_grants != [] %}
|
||||
mysql_salt_user_with_salt_user_grants:
|
||||
|
@ -49,9 +51,11 @@ mysql_salt_user_with_salt_user_grants:
|
|||
- VALUE=$(mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'Y' ]; then /bin/true; else /bin/false; fi
|
||||
- require:
|
||||
- mysql_user: mysql_salt_user_with_salt_user
|
||||
{% if os_family in ['RedHat', 'Suse'] %}
|
||||
- require_in:
|
||||
- mysql_user: mysql_root_password
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
mysql_salt_user_with_root_user:
|
||||
mysql_user.present:
|
||||
|
@ -65,8 +69,10 @@ mysql_salt_user_with_root_user:
|
|||
- onlyif:
|
||||
- mysql --user {{ mysql_root_user }} --password='{{ mysql_root_pass|replace("'", "'\"'\"'") }}' -h {{ mysql_host }} --execute="SELECT 1;"
|
||||
- VALUE=$(mysql --user {{ mysql_root_user }} --password='{{ mysql_root_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi
|
||||
{% if os_family in ['RedHat', 'Suse'] %}
|
||||
- require_in:
|
||||
- mysql_user: mysql_root_password
|
||||
{% endif %}
|
||||
|
||||
{%- if mysql_salt_grants != [] %}
|
||||
mysql_salt_user_with_root_user_grants:
|
||||
|
@ -86,9 +92,11 @@ mysql_salt_user_with_root_user_grants:
|
|||
- VALUE=$(mysql --user {{ mysql_root_user }} --password='{{ mysql_root_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi
|
||||
- require:
|
||||
- mysql_user: mysql_salt_user_with_root_user
|
||||
{% if os_family in ['RedHat', 'Suse'] %}
|
||||
- require_in:
|
||||
- mysql_user: mysql_root_password
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
mysql_salt_user_with_passwordless_root_user:
|
||||
mysql_user.present:
|
||||
|
@ -101,8 +109,10 @@ mysql_salt_user_with_passwordless_root_user:
|
|||
- onlyif:
|
||||
- mysql --user {{ mysql_root_user }} -h {{ mysql_host }} --execute="SELECT 1;"
|
||||
- VALUE=$(mysql --user {{ mysql_root_user }} -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi
|
||||
{% if os_family in ['RedHat', 'Suse'] %}
|
||||
- require_in:
|
||||
- mysql_user: mysql_root_password
|
||||
{% endif %}
|
||||
|
||||
{%- if mysql_salt_grants != [] %}
|
||||
mysql_salt_user_with_passwordless_root_user_grants:
|
||||
|
@ -121,11 +131,13 @@ mysql_salt_user_with_passwordless_root_user_grants:
|
|||
- VALUE=$(mysql --user {{ mysql_root_user }} -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi
|
||||
- require:
|
||||
- mysql_user: mysql_salt_user_with_passwordless_root_user
|
||||
{% if os_family in ['RedHat', 'Suse'] %}
|
||||
- require_in:
|
||||
- mysql_user: mysql_root_password
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if os_family == 'RedHat' or 'Suse' %}
|
||||
{% if os_family in ['RedHat', 'Suse'] %}
|
||||
extend:
|
||||
mysql_root_password:
|
||||
cmd.run:
|
||||
|
|
|
@ -30,7 +30,7 @@ mysql_debconf:
|
|||
- pkg: {{ mysql.server }}
|
||||
- require:
|
||||
- pkg: mysql_debconf_utils
|
||||
{% elif os_family == 'RedHat' or 'Suse' %}
|
||||
{% elif os_family in ['RedHat', 'Suse'] %}
|
||||
mysql_root_password:
|
||||
cmd.run:
|
||||
- name: mysqladmin --user {{ mysql_root_user }} password '{{ mysql_root_password|replace("'", "'\"'\"'") }}'
|
||||
|
|
Loading…
Add table
Reference in a new issue