-
Notifications
You must be signed in to change notification settings - Fork 794
/
Copy pathconfig.pp
94 lines (85 loc) · 3.19 KB
/
config.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# @summary
# Private class for MySQL server configuration.
#
# @api private
#
class mysql::server::config {
$options = $mysql::server::_options
$includedir = $mysql::server::includedir
$managed_dirs = $mysql::server::managed_dirs
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,
}
# on some systems this is /etc/my.cnf.d, while Debian has /etc/mysql/conf.d and FreeBSD something in /usr/local. For the latter systems,
# managing this basedir is also required, to have it available before the package is installed.
$includeparentdir = dirname($includedir)
if $includeparentdir != '/' and $includeparentdir != '/etc' {
file { $includeparentdir:
ensure => directory,
mode => '0755',
}
}
}
#Debian: Creating world readable directories before installing.
case $::operatingsystem {
'Debian': {
if $managed_dirs {
$managed_dirs.each | $entry | {
$dir = $options['mysqld']["${entry}"]
if ( $dir and $dir != '/usr' and $dir != '/tmp' ) {
exec {"${entry}-managed_dir-mkdir":
command => "/bin/mkdir -p ${dir}",
unless => "/usr/bin/dpkg -s ${mysql::server::package_name}",
notify => Exec["${entry}-managed_dir-chmod"],
}
exec {"${entry}-managed_dir-chmod":
command => "/bin/chmod 777 ${dir}",
refreshonly => true,
}
}
}
}
}
default: {}
}
if $mysql::server::manage_config_file {
file { 'mysql-config-file':
path => $mysql::server::config_file,
content => template('mysql/my.cnf.erb'),
mode => $mysql::server::config_file_mode,
owner => $mysql::server::mycnf_owner,
group => $mysql::server::mycnf_group,
selinux_ignore_defaults => true,
}
# on mariadb systems, $includedir is not defined, but /etc/my.cnf.d has
# to be managed to place the server.cnf there
$configparentdir = dirname($mysql::server::config_file)
# Before setting $configparentdir we first check to make sure that it's value is valid
if $configparentdir != '/' and $configparentdir != '/etc' {
# We then check that the value of $includedir is either undefined or that different from $configparentdir
# We first check that it is undefined due to dirname throwing an error when given undef/empty strings
if $includedir == undef or $includedir == '' or
($configparentdir != $includedir and $configparentdir != dirname($includedir)) {
file { $configparentdir:
ensure => directory,
mode => '0755',
}
}
}
}
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'
}
}
}