-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete all features to release version 0.2.3
[BUG #4] The mariadb root password is now fully managed by this recipe [ENH #7] It's possible to activate/deactivate remote root access via this recipe - Add multiples serverspec/kitchen tests to avoid regression - Complete Documentation (ChangeLog and ReadMe)
- Loading branch information
1 parent
6c0e4f9
commit fc7d991
Showing
12 changed files
with
258 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# Cookbook Name:: mariadb | ||
# Recipe:: _debian_server | ||
# | ||
# Copyright 2014, blablacar.com | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# To be sure that debconf is installed | ||
package 'debconf-utils' do | ||
action :install | ||
end | ||
|
||
# Preseed Debian Packages | ||
directory '/var/cache/local/preseeding' do | ||
owner 'root' | ||
group 'root' | ||
mode '0755' | ||
recursive true | ||
end | ||
|
||
template '/var/cache/local/preseeding/mariadb-server.seed' do | ||
source 'mariadb-server.seed.erb' | ||
owner 'root' | ||
group 'root' | ||
mode '0600' | ||
notifies :run, 'execute[preseed mariadb-server]', :immediately | ||
end | ||
|
||
execute 'preseed mariadb-server' do | ||
command '/usr/bin/debconf-set-selections ' \ | ||
'/var/cache/local/preseeding/mariadb-server.seed' | ||
action :nothing | ||
end | ||
|
||
package "mariadb-server-#{node['mariadb']['install']['version']}" do | ||
action :install | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# Cookbook Name:: mariadb | ||
# Recipe:: _redhat_server | ||
# | ||
# Copyright 2014, blablacar.com | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
package 'MariaDB-server' do | ||
action :install | ||
notifies :run, 'execute[change first install root password]', :immediately | ||
end | ||
|
||
directory '/var/log/mysql' do | ||
action :create | ||
user 'mysql' | ||
group 'mysql' | ||
mode '0755' | ||
end | ||
|
||
execute 'change first install root password' do | ||
command '/etc/init.d/mysql start ; ' \ | ||
'/usr/bin/mysqladmin -u root password \'' + \ | ||
node['mariadb']['server_root_password'] + '\'' | ||
action :nothing | ||
not_if { node['mariadb']['server_root_password'].empty? } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<% | ||
# Value obtained via the debconf-get-selections tool on debian wheezy | ||
case node['mariadb']['install']['version'] | ||
when '5.5' -%> | ||
mariadb-server-5.5 mysql-server/root_password_again select <%= node['mariadb']['server_root_password'] %> | ||
mariadb-server-5.5 mysql-server/root_password select <%= node['mariadb']['server_root_password'] %> | ||
mariadb-server-5.5 mysql-server/error_setting_password error | ||
mariadb-server-5.5 mysql-server-5.1/nis_warning note | ||
mariadb-server-5.5 mysql-server-5.1/start_on_boot boolean true | ||
mariadb-server-5.5 mariadb-server-5.5/really_downgrade boolean false | ||
mariadb-server-5.5 mysql-server-5.1/postrm_remove_databases boolean false | ||
mariadb-server-5.5 mysql-server/password_mismatch error | ||
mariadb-server-5.5 mysql-server/no_upgrade_when_using_ndb error | ||
<% else -%> | ||
mariadb-server-10.0 mysql-server/root_password_again select <%= node['mariadb']['server_root_password'] %> | ||
mariadb-server-10.0 mysql-server/root_password select <%= node['mariadb']['server_root_password'] %> | ||
mariadb-server-10.0 mysql-server/error_setting_password boolean false | ||
mariadb-server-10.0 mysql-server-5.1/nis_warning note | ||
mariadb-server-10.0 mysql-server-5.1/start_on_boot boolean true | ||
mariadb-server-10.0 mariadb-server-10.0/really_downgrade boolean false | ||
mariadb-server-10.0 mysql-server-5.1/postrm_remove_databases boolean false | ||
mariadb-server-10.0 mysql-server/password_mismatch boolean false | ||
mariadb-server-10.0 mysql-server/no_upgrade_when_using_ndb boolean true | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# Generated by CHEF | ||
# Local modification will be overriden | ||
|
||
<% if node['mariadb']['allow_root_pass_change'] -%> | ||
<% if node['mariadb']['server_root_password'].empty? -%> | ||
/usr/bin/mysqladmin -u root password "$1" | ||
<% else -%> | ||
/usr/bin/mysqladmin -u root -p'<%= node['mariadb']['server_root_password'] %>' password "$1" | ||
<% end -%> | ||
|
||
<% end -%> | ||
password_flag="" | ||
if [ "$1" ]; then | ||
password_flag="-p'$1'" | ||
fi | ||
|
||
<% if node['mariadb']['forbid_remote_root'] -%> | ||
user_exist=`/usr/bin/mysql -u root ${password_flag} -D mysql -r -B -N -e "SELECT user from user where user = 'root' and host = '%'"` | ||
if [ $user_exist == 'root' ]; then | ||
/bin/echo "DROP USER 'root'@'%';" | /usr/bin/mysql -u root ${password_flag} | ||
fi | ||
<% else -%> | ||
/bin/echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '<%= node['mariadb']['server_root_password'] %>' WITH GRANT OPTION;" | /usr/bin/mysql -u root ${password_flag} | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters