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:
parent
ef9e2080bf
commit
2727d787e8
@ -212,22 +212,11 @@ class cloud::database::sql (
|
|||||||
unless => 'test `du -sh /var/lib/mysql/ib_logfile0 | cut -f1` = "256M"',
|
unless => 'test `du -sh /var/lib/mysql/ib_logfile0 | cut -f1` = "256M"',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
file{'/etc/mysql/sys.cnf':
|
file{'/etc/mysql/sys.cnf':
|
||||||
content => "# Managed by Puppet
|
ensure => file,
|
||||||
# Module cloud::database::sql
|
content => template('cloud/database/sys.cnf.erb'),
|
||||||
[client]
|
owner => 'root',
|
||||||
host = localhost
|
group => 'root',
|
||||||
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
|
|
||||||
",
|
|
||||||
mode => '0600',
|
mode => '0600',
|
||||||
require => Exec['clean-mysql-binlog'],
|
require => Exec['clean-mysql-binlog'],
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ describe 'cloud::database::sql' do
|
|||||||
:config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password] },
|
:config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password] },
|
||||||
:notify => 'Service[xinetd]'
|
:notify => 'Service[xinetd]'
|
||||||
)
|
)
|
||||||
end
|
end # configure mysql galera server
|
||||||
|
|
||||||
context 'configure mysqlchk http replication' do
|
context 'configure mysqlchk http replication' do
|
||||||
it { should contain_file_line('mysqlchk-in-etc-services').with(
|
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('/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]}/)}
|
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
|
context 'configure databases on the galera master server' do
|
||||||
|
|
||||||
@ -171,10 +171,22 @@ describe 'cloud::database::sql' do
|
|||||||
:password_hash => '*BE353D0D7826681F8B7C136ED9824915F5B99E7D',
|
:password_hash => '*BE353D0D7826681F8B7C136ED9824915F5B99E7D',
|
||||||
:provider => 'mysql'
|
:provider => 'mysql'
|
||||||
)
|
)
|
||||||
end
|
end # configure monitoring database
|
||||||
end
|
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
|
context 'on Debian platforms' do
|
||||||
let :facts do
|
let :facts do
|
||||||
|
14
templates/database/sys.cnf.erb
Normal file
14
templates/database/sys.cnf.erb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user