Update cookbooks and add wordpress cookbook

This commit is contained in:
Greg Karékinian
2016-02-19 18:09:49 +01:00
parent 9ba973e3ac
commit 820b0ab3f8
606 changed files with 22421 additions and 14084 deletions

View File

@@ -3,6 +3,18 @@ mariadb CHANGELOG
This file is used to list changes made in each version of the mariadb cookbook.
0.3.1
-----
- [BUG #76] - Service is restarted every run if not localhost
- [BUG #73] - Fix directory permissions regression
- [BUG #69] - Update repository.rb to be able to manage Scientific Linux
- [BUG #57] - Add user and password to correct debian-grants
- [ENH #71] - Add xtrabackup-v2 support for SST Method
- [ENH #62] - Allow Galera cluster nodes to be configured when using Chef Solo
- [ENH #64] - Add a vagrant config to test a galera cluster
- [BUG #66] - mariadb_configuration template uses current cookbook as template source
- [BUG #68] - Correct service name inconsistency on CentOS 7
0.3.0
------
- [ENH] - Add support for using operating system shipped mariadb packages

View File

@@ -21,7 +21,11 @@ end
default['mariadb']['forbid_remote_root'] = true
default['mariadb']['server_root_password'] = ''
default['mariadb']['allow_root_pass_change'] = false
default['mariadb']['mysqld']['service_name'] = 'mysql'
if node['platform'] == 'centos'
default['mariadb']['mysqld']['service_name'] = 'mariadb'
else
default['mariadb']['mysqld']['service_name'] = 'mysql'
end
default['mariadb']['mysqld']['user'] = 'mysql'
default['mariadb']['mysqld']['port'] = '3306'
default['mariadb']['mysqld']['basedir'] = '/usr'
@@ -82,6 +86,9 @@ default['mariadb']['galera']['wsrep_provider'] = \
'/usr/lib/galera/libgalera_smm.so'
default['mariadb']['galera']['options'] = {}
# Node format: [{ :name => "mariadb_1", fqdn: "33.33.33.11"}]
default['mariadb']['galera']['cluster_nodes'] = []
#
# Replication default configuration
#
@@ -92,6 +99,7 @@ default['mariadb']['replication']['log_bin_index'] = \
'/var/log/mysql/mariadb-bin.index'
default['mariadb']['replication']['expire_logs_days'] = '10'
default['mariadb']['replication']['max_binlog_size'] = '100M'
default['mariadb']['replication']['options'] = {}
#
# mysqldump default configuration

View File

@@ -53,7 +53,7 @@ module MariaDB
def os_service_name(os_platform, os_version)
return nil unless os_package_provided?(os_platform, os_version)
service_name = 'mariadb'
if os_platform == 'fedora' && os_version.to_i == 19
if os_platform == 'fedora' && os_version.to_i >= 19
service_name = 'mysqld'
end
service_name

File diff suppressed because one or more lines are too long

View File

@@ -20,7 +20,7 @@ action :add do
owner 'root'
group 'mysql'
mode '0640'
cookbook new_resource.cookbook
cookbook 'mariadb'
variables variables_hash
end
end

View File

@@ -43,3 +43,6 @@ execute 'change first install root password' do
action :nothing
not_if { node['mariadb']['server_root_password'].empty? }
end
# Default policy for RH and fedora is to name it mysql
node.set['mariadb']['mysqld']['service_name'] = 'mysql'

View File

@@ -22,16 +22,16 @@ service_name = os_service_name(node['platform'], node['platform_version'])
node.set['mariadb']['mysqld']['service_name'] = service_name\
unless service_name.nil?
package 'mariadb-server' do
action :install
notifies :enable, 'service[mysql]'
end
directory '/var/log/mysql' do
action :create
user 'mysql'
group 'mysql'
mode '0755'
end
package 'mariadb-server' do
action :install
notifies :enable, 'service[mysql]'
notifies :start, 'service[mysql]', :immediately
notifies :run, 'execute[change first install root password]', :immediately
end

View File

@@ -48,7 +48,7 @@ if node['mariadb']['innodb']['bps_percentage_memory']
(
node['mariadb']['innodb']['buffer_pool_size'].to_f *
(node['memory']['total'][0..-3].to_i / 1024)
).round).to_s + 'M'
).round).to_s + 'M'
else
innodb_options['innodb_buffer_pool_size'] = \
node['mariadb']['innodb']['buffer_pool_size']
@@ -73,6 +73,7 @@ mariadb_configuration 'innodb' do
end
replication_opts = {}
replication_opts['log_bin'] = node['mariadb']['replication']['log_bin']
replication_opts['log_bin_index'] = \
node['mariadb']['replication']['log_bin_index']
@@ -83,10 +84,8 @@ replication_opts['max_binlog_size'] = \
unless node['mariadb']['replication']['server_id'].empty?
replication_opts['server-id'] = node['mariadb']['replication']['server_id']
end
if node['mariadb']['replication'].key?('options')
node['mariadb']['replication']['options'].each do |key, value|
replication_opts[key] = value
end
node['mariadb']['replication']['options'].each do |key, value|
replication_opts[key] = value
end
mariadb_configuration 'replication' do

View File

@@ -37,7 +37,7 @@ if node['mariadb']['galera']['wsrep_sst_method'] == 'rsync'
action :install
end
else
if node['mariadb']['galera']['wsrep_sst_method'] == 'xtrabackup'
if node['mariadb']['galera']['wsrep_sst_method'] =~ /^xtrabackup(-v2)?/
package 'percona-xtrabackup' do
action :install
end
@@ -52,7 +52,12 @@ include_recipe "#{cookbook_name}::config"
galera_cluster_nodes = []
if !node['mariadb'].attribute?('rspec') && Chef::Config[:solo]
Chef::Log.warn('This recipe uses search. Chef Solo does not support search.')
if node['mariadb']['galera']['cluster_nodes'].empty?
Chef::Log.warn('By default this recipe uses search (unsupported by Chef Solo).' \
' Nodes may manually be configured as attributes.')
else
galera_cluster_nodes = node['mariadb']['galera']['cluster_nodes']
end
else
if node['mariadb']['galera']['cluster_search_query'].empty?
galera_cluster_nodes = search(
@@ -116,17 +121,28 @@ if platform?('debian', 'ubuntu')
mode '0600'
end
grants_command = 'mysql -r -B -N -u root '
if node['mariadb']['server_root_password'].is_a?(String)
grants_command += '--password=\'' + \
node['mariadb']['server_root_password'] + '\' '
end
grants_command += '-e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ' \
'DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, ' \
'INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY ' \
'TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, ' \
'REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ' \
'ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON ' \
' *.* TO \'' + node['mariadb']['debian']['user'] + \
'\'@\'' + node['mariadb']['debian']['host'] + '\' ' \
'IDENTIFIED BY \'' + \
node['mariadb']['debian']['password'] + '\' WITH GRANT ' \
'OPTION"'
execute 'correct-debian-grants' do
# Add sensitive true when foodcritic #233 fixed
command 'mysql -r -B -N -e "GRANT SELECT, INSERT, UPDATE, DELETE, '\
'CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, '\
'ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, '\
'LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, '\
'CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, '\
"CREATE USER, EVENT, TRIGGER ON *.* TO '" + \
node['mariadb']['debian']['user'] + \
"'@'" + node['mariadb']['debian']['host'] + "' IDENTIFIED BY '" + \
node['mariadb']['debian']['password'] + "' WITH GRANT OPTION\""
command grants_command
action :run
only_if do
cmd = Mixlib::ShellOut.new("/usr/bin/mysql --user=\"" + \
@@ -139,3 +155,25 @@ if platform?('debian', 'ubuntu')
ignore_failure true
end
end
#
# NOTE: You cannot use the following code to restart Mariadb when in Galera mode.
# When your SST is longer than a chef run...
# ==> chef-client try to restart the service each time it run <==
#
# restart the service if needed
# workaround idea from https://github.com/stissot
#
# Chef::Resource::Execute.send(:include, MariaDB::Helper)
# execute 'mariadb-service-restart-needed' do
# command 'true'
# only_if do
# mariadb_service_restart_required?(
# node['mariadb']['mysqld']['bind-address'],
# node['mariadb']['mysqld']['port'],
# node['mariadb']['mysqld']['socket']
# )
# end
# notifies :restart, 'service[mysql]', :immediately
# end

View File

@@ -12,7 +12,7 @@ if node['mariadb']['use_default_repository']
apt_repository "mariadb-#{node['mariadb']['install']['version']}" do
uri 'http://' + node['mariadb']['apt_repository']['base_url'] + '/' + \
node['mariadb']['install']['version'] + '/' + node['platform']
node['mariadb']['install']['version'] + '/' + node['platform']
distribution node['lsb']['codename']
components ['main']
keyserver 'hkp://keyserver.ubuntu.com:80'
@@ -21,7 +21,7 @@ if node['mariadb']['use_default_repository']
when 'yum'
include_recipe 'yum::default'
if node['platform'] == 'redhat'
if node['platform'] == 'redhat' || node['platform'] == 'scientific'
target_platform = "rhel#{node['platform_version'].to_i}"
else
target_platform = "#{node['platform']}#{node['platform_version'].to_i}"
@@ -35,7 +35,7 @@ if node['mariadb']['use_default_repository']
end
case node['platform']
when 'redhat', 'centos'
when 'redhat', 'centos', 'scientific'
include_recipe 'yum-epel::default'
end
end

View File

@@ -82,7 +82,7 @@ execute 'mariadb-service-restart-needed' do
command 'true'
only_if do
mariadb_service_restart_required?(
'127.0.0.1',
node['mariadb']['mysqld']['bind_address'],
node['mariadb']['mysqld']['port'],
node['mariadb']['mysqld']['socket']
)