Merge pull request #179 from saltstack-formulas/freebsd-support

FreeBSD support & opt-in state to enforce root password
This commit is contained in:
alxwr 2018-03-26 12:13:49 +02:00 committed by GitHub
commit f777aeb891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 5 deletions

View file

@ -45,6 +45,12 @@ debconf.
cryptographically insecure, future formula versions should use the
newly available ``random.get_str`` method.
``mysql.server_checks``
-----------------------
Enforces a root password to be set.
``mysql.disabled``
------------------

View file

@ -368,7 +368,7 @@ FreeBSD:
server: mysql56-server
client: mysql56-client
service: mysql-server
python: pymysql
python: py27-pymysql
dev: mysql56-server
config:
file: /usr/local/etc/my.cnf

View file

@ -12,6 +12,7 @@ mysql remove test database:
- name: test
- host: '{{ mysql_host }}'
- connection_user: '{{ mysql_salt_user }}'
- connection_host: '{{ mysql_host }}'
{% if mysql_salt_pass %}
- connection_pass: '{{ mysql_salt_pass }}'
{% endif %}

View file

@ -31,11 +31,11 @@ mysql_debconf:
- pkg: {{ mysql.server }}
- require:
- pkg: mysql_debconf_utils
{% elif os_family in ['RedHat', 'Suse'] %}
{% elif os_family in ['RedHat', 'Suse', 'FreeBSD'] %}
mysql_root_password:
cmd.run:
- name: mysqladmin --user {{ mysql_root_user }} password '{{ mysql_root_password|replace("'", "'\"'\"'") }}'
- unless: mysql --user {{ mysql_root_user }} --password='{{ mysql_root_password|replace("'", "'\"'\"'") }}' --execute="SELECT 1;"
- name: mysqladmin --host "{{ mysql_host }}" --user {{ mysql_root_user }} password '{{ mysql_root_password|replace("'", "'\"'\"'") }}'
- unless: mysql --host "{{ mysql_host }}" --user {{ mysql_root_user }} --password='{{ mysql_root_password|replace("'", "'\"'\"'") }}' --execute="SELECT 1;"
- require:
- service: mysqld

4
mysql/server_checks.sls Normal file
View file

@ -0,0 +1,4 @@
check_pillar_for_root_password:
test.check_pillar:
- present:
- mysql:server:root_password

View file

@ -125,7 +125,9 @@ mysql:
# server: mysql-server
# client: mysql-client
# service: mysql-service
# python: python-mysqldb
# server:
# lookup:
# python: python-mysqldb
# Install MySQL headers
dev: