Use a proper template for sys.cnf MySQL config

Just a cosmetic commit, and properly setup owner/group (0600)
it's important!

Refs: #25
This commit is contained in:
Sebastien Badia 2014-01-22 11:21:59 +01:00
parent ef9e2080bf
commit 2727d787e8
3 changed files with 35 additions and 20 deletions

View File

@ -212,22 +212,11 @@ class cloud::database::sql (
unless => 'test `du -sh /var/lib/mysql/ib_logfile0 | cut -f1` = "256M"',
}
file{'/etc/mysql/sys.cnf':
content => "# Managed by Puppet
# Module cloud::database::sql
[client]
host = localhost
user = sys-maint
password = ${mysql_sys_maint_password}
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = sys-maint
password = ${mysql_sys_maint_password}
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
",
ensure => file,
content => template('cloud/database/sys.cnf.erb'),
owner => 'root',
group => 'root',
mode => '0600',
require => Exec['clean-mysql-binlog'],
}

View File

@ -76,7 +76,7 @@ describe 'cloud::database::sql' do
:config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password] },
:notify => 'Service[xinetd]'
)
end
end # configure mysql galera server
context 'configure mysqlchk http replication' do
it { should contain_file_line('mysqlchk-in-etc-services').with(
@ -91,7 +91,7 @@ describe 'cloud::database::sql' do
it { should contain_file('/usr/bin/clustercheck').with_content(/MYSQL_PASSWORD="#{params[:galera_clustercheck_dbpassword]}"/)}
it { should contain_file('/etc/xinetd.d/mysqlchk').with_content(/bind = #{params[:galera_clustercheck_ipaddress]}/)}
end
end # configure mysqlchk http replication
context 'configure databases on the galera master server' do
@ -171,10 +171,22 @@ describe 'cloud::database::sql' do
:password_hash => '*BE353D0D7826681F8B7C136ED9824915F5B99E7D',
:provider => 'mysql'
)
end
end
end # configure monitoring database
end # configure databases on the galera master server
end
context 'configure MySQL sys config' do
it { should contain_file('/etc/mysql/sys.cnf').with(
:mode => '0600',
:owner => 'root',
:group => 'root',
:require => 'Exec[clean-mysql-binlog]'
)}
it { should contain_file('/etc/mysql/sys.cnf').with_content(/password = #{params[:mysql_sys_maint_password]}/)}
end # configure MySQL sys config
end # openstack database sql
context 'on Debian platforms' do
let :facts do

View File

@ -0,0 +1,14 @@
# Managed by Puppet
# Module cloud::database::sql
#
[client]
host = localhost
user = sys-maint
password = <%= @mysql_sys_maint_password %>
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = sys-maint
password = <%= @mysql_sys_maint_password %>
socket = /var/run/mysqld/mysqld.sock
basedir = /usr