module-puppetlabs-mysql/manifests/server/config.pp
Emilien Macchi ba52d1d6e9 Ensure idempotency between Puppet runs
Running RHEL 7.1, puppetlabs-mysql is not idempotent.
After a second run, puppet tries to change the SElinux context:
/File[mysql-config-file]/seltype: seltype changed 'etc_t' to
'mysqld_etc_t'

Since packaging already manages SElinux labels, we should not let
Puppet doing it (default behavior).
This patch aims to set selinux_ignore_defaults to True for the
mysql-config-file File resource.

Thanks to that patch, Puppet will be indempotent between all runs on
RHEL platforms.
2015-08-04 13:38:03 -04:00

52 lines
1.4 KiB
Puppet

# See README.me for options.
class mysql::server::config {
$options = $mysql::server::options
$includedir = $mysql::server::includedir
File {
owner => 'root',
group => $mysql::server::root_group,
mode => '0400',
}
if $includedir and $includedir != '' {
file { $includedir:
ensure => directory,
mode => '0755',
recurse => $mysql::server::purge_conf_dir,
purge => $mysql::server::purge_conf_dir,
}
}
$logbin = pick($options['mysqld']['log-bin'], $options['mysqld']['log_bin'], false)
if $logbin {
$logbindir = mysql_dirname($logbin)
#Stop puppet from managing directory if just a filename/prefix is specified
if $logbindir != '.' {
file { $logbindir:
ensure => directory,
mode => '0755',
owner => $options['mysqld']['user'],
group => $options['mysqld']['user'],
}
}
}
if $mysql::server::manage_config_file {
file { 'mysql-config-file':
path => $mysql::server::config_file,
content => template('mysql/my.cnf.erb'),
mode => '0644',
selinux_ignore_defaults => true,
}
}
if $options['mysqld']['ssl-disable'] {
notify {'ssl-disable':
message =>'Disabling SSL is evil! You should never ever do this except if you are forced to use a mysql version compiled without SSL support'
}
}
}