comparison modules/mysql/manifests/params.pp @ 0:956e484adc12

Initial public release of Puppet configs
author IBBoard <dev@ibboard.co.uk>
date Sat, 16 Aug 2014 19:47:38 +0000
parents
children 58d1818c2ded
comparison
equal deleted inserted replaced
-1:000000000000 0:956e484adc12
1 # Private class: See README.md.
2 class mysql::params {
3
4 $manage_config_file = true
5 $old_root_password = ''
6 $purge_conf_dir = false
7 $restart = false
8 $root_password = 'UNSET'
9 $server_package_ensure = 'present'
10 $server_service_manage = true
11 $server_service_enabled = true
12 # mysql::bindings
13 $bindings_enable = false
14 $java_package_ensure = 'present'
15 $java_package_provider = undef
16 $perl_package_ensure = 'present'
17 $perl_package_provider = undef
18 $php_package_ensure = 'present'
19 $php_package_provider = undef
20 $python_package_ensure = 'present'
21 $python_package_provider = undef
22 $ruby_package_ensure = 'present'
23 $ruby_package_provider = undef
24
25
26 case $::osfamily {
27 'RedHat': {
28 case $::operatingsystem {
29 'Fedora': {
30 if is_integer($::operatingsystemrelease) and $::operatingsystemrelease >= 19 or $::operatingsystemrelease == "Rawhide" {
31 $provider = 'mariadb'
32 } else {
33 $provider = 'mysql'
34 }
35 }
36 'RedHat': {
37 if $::operatingsystemrelease >= 7 {
38 $provider = 'mariadb'
39 } else {
40 $provider = 'mysql'
41 }
42 }
43 default: {
44 $provider = 'mysql'
45 }
46 }
47
48 if $provider == 'mariadb' {
49 $client_package_name = 'mariadb'
50 $server_package_name = 'mariadb-server'
51 $server_service_name = 'mariadb'
52 $log_error = '/var/log/mariadb/mariadb.log'
53 $config_file = '/etc/my.cnf'
54 $pidfile = '/var/run/mariadb/mariadb.pid'
55 } else {
56 $client_package_name = 'mysql'
57 $server_package_name = 'mysql-server'
58 $server_service_name = 'mysqld'
59 $log_error = '/var/log/mysqld.log'
60 $config_file = '/etc/my.cnf'
61 $pidfile = '/var/run/mysqld/mysqld.pid'
62 }
63
64 $basedir = '/usr'
65 $datadir = '/var/lib/mysql'
66 $root_group = 'root'
67 $socket = '/var/lib/mysql/mysql.sock'
68 $ssl_ca = '/etc/mysql/cacert.pem'
69 $ssl_cert = '/etc/mysql/server-cert.pem'
70 $ssl_key = '/etc/mysql/server-key.pem'
71 $tmpdir = '/tmp'
72 # mysql::bindings
73 $java_package_name = 'mysql-connector-java'
74 $perl_package_name = 'perl-DBD-MySQL'
75 $php_package_name = 'php-mysql'
76 $python_package_name = 'MySQL-python'
77 $ruby_package_name = 'ruby-mysql'
78 }
79
80 'Suse': {
81 $client_package_name = $::operatingsystem ? {
82 /OpenSuSE/ => 'mysql-community-server-client',
83 /(SLES|SLED)/ => 'mysql-client',
84 }
85 $server_package_name = $::operatingsystem ? {
86 /OpenSuSE/ => 'mysql-community-server',
87 /(SLES|SLED)/ => 'mysql',
88 }
89 $basedir = '/usr'
90 $config_file = '/etc/my.cnf'
91 $datadir = '/var/lib/mysql'
92 $log_error = $::operatingsystem ? {
93 /OpenSuSE/ => '/var/log/mysql/mysqld.log',
94 /(SLES|SLED)/ => '/var/log/mysqld.log',
95 }
96 $pidfile = $::operatingsystem ? {
97 /OpenSuSE/ => '/var/run/mysql/mysqld.pid',
98 /(SLES|SLED)/ => '/var/lib/mysql/mysqld.pid',
99 }
100 $root_group = 'root'
101 $server_service_name = 'mysql'
102 $socket = $::operatingsystem ? {
103 /OpenSuSE/ => '/var/run/mysql/mysql.sock',
104 /(SLES|SLED)/ => '/var/lib/mysql/mysql.sock',
105 }
106 $ssl_ca = '/etc/mysql/cacert.pem'
107 $ssl_cert = '/etc/mysql/server-cert.pem'
108 $ssl_key = '/etc/mysql/server-key.pem'
109 $tmpdir = '/tmp'
110 # mysql::bindings
111 $java_package_name = 'mysql-connector-java'
112 $perl_package_name = 'perl-DBD-mysql'
113 $php_package_name = 'apache2-mod_php53'
114 $python_package_name = 'python-mysql'
115 $ruby_package_name = $::operatingsystem ? {
116 /OpenSuSE/ => 'rubygem-mysql',
117 /(SLES|SLED)/ => 'ruby-mysql',
118 }
119 }
120
121 'Debian': {
122 $client_package_name = 'mysql-client'
123 $server_package_name = 'mysql-server'
124
125 $basedir = '/usr'
126 $config_file = '/etc/mysql/my.cnf'
127 $datadir = '/var/lib/mysql'
128 $log_error = '/var/log/mysql/error.log'
129 $pidfile = '/var/run/mysqld/mysqld.pid'
130 $root_group = 'root'
131 $server_service_name = 'mysql'
132 $socket = '/var/run/mysqld/mysqld.sock'
133 $ssl_ca = '/etc/mysql/cacert.pem'
134 $ssl_cert = '/etc/mysql/server-cert.pem'
135 $ssl_key = '/etc/mysql/server-key.pem'
136 $tmpdir = '/tmp'
137 # mysql::bindings
138 $java_package_name = 'libmysql-java'
139 $perl_package_name = 'libdbd-mysql-perl'
140 $php_package_name = 'php5-mysql'
141 $python_package_name = 'python-mysqldb'
142 $ruby_package_name = $::lsbdistcodename ? {
143 'trusty' => 'ruby-mysql',
144 default => 'libmysql-ruby',
145 }
146 }
147
148 'FreeBSD': {
149 $client_package_name = 'databases/mysql55-client'
150 $server_package_name = 'databases/mysql55-server'
151 $basedir = '/usr/local'
152 $config_file = '/var/db/mysql/my.cnf'
153 $datadir = '/var/db/mysql'
154 $log_error = "/var/db/mysql/${::hostname}.err"
155 $pidfile = '/var/db/mysql/mysql.pid'
156 $root_group = 'wheel'
157 $server_service_name = 'mysql-server'
158 $socket = '/tmp/mysql.sock'
159 $ssl_ca = undef
160 $ssl_cert = undef
161 $ssl_key = undef
162 $tmpdir = '/tmp'
163 # mysql::bindings
164 $java_package_name = 'databases/mysql-connector-java'
165 $perl_package_name = 'p5-DBD-mysql'
166 $php_package_name = 'php5-mysql'
167 $python_package_name = 'databases/py-MySQLdb'
168 $ruby_package_name = 'databases/ruby-mysql'
169 }
170
171 default: {
172 case $::operatingsystem {
173 'Amazon': {
174 $client_package_name = 'mysql'
175 $server_package_name = 'mysql-server'
176 $basedir = '/usr'
177 $config_file = '/etc/my.cnf'
178 $datadir = '/var/lib/mysql'
179 $log_error = '/var/log/mysqld.log'
180 $pidfile = '/var/run/mysqld/mysqld.pid'
181 $root_group = 'root'
182 $server_service_name = 'mysqld'
183 $socket = '/var/lib/mysql/mysql.sock'
184 $ssl_ca = '/etc/mysql/cacert.pem'
185 $ssl_cert = '/etc/mysql/server-cert.pem'
186 $ssl_key = '/etc/mysql/server-key.pem'
187 $tmpdir = '/tmp'
188 # mysql::bindings
189 $java_package_name = 'mysql-connector-java'
190 $perl_package_name = 'perl-DBD-MySQL'
191 $php_package_name = 'php-mysql'
192 $python_package_name = 'MySQL-python'
193 $ruby_package_name = 'ruby-mysql'
194 }
195
196 default: {
197 fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat, Debian, and FreeBSD, or operatingsystem Amazon")
198 }
199 }
200 }
201 }
202
203 case $::operatingsystem {
204 'Ubuntu': {
205 $server_service_provider = upstart
206 }
207 default: {
208 $server_service_provider = undef
209 }
210 }
211
212 $default_options = {
213 'client' => {
214 'port' => '3306',
215 'socket' => $mysql::params::socket,
216 },
217 'mysqld_safe' => {
218 'nice' => '0',
219 'log-error' => $mysql::params::log_error,
220 'socket' => $mysql::params::socket,
221 },
222 'mysqld' => {
223 'basedir' => $mysql::params::basedir,
224 'bind-address' => '127.0.0.1',
225 'datadir' => $mysql::params::datadir,
226 'expire_logs_days' => '10',
227 'key_buffer_size' => '16M',
228 'log-error' => $mysql::params::log_error,
229 'max_allowed_packet' => '16M',
230 'max_binlog_size' => '100M',
231 'max_connections' => '151',
232 'myisam_recover' => 'BACKUP',
233 'pid-file' => $mysql::params::pidfile,
234 'port' => '3306',
235 'query_cache_limit' => '1M',
236 'query_cache_size' => '16M',
237 'skip-external-locking' => true,
238 'socket' => $mysql::params::socket,
239 'ssl' => false,
240 'ssl-ca' => $mysql::params::ssl_ca,
241 'ssl-cert' => $mysql::params::ssl_cert,
242 'ssl-key' => $mysql::params::ssl_key,
243 'ssl-disable' => false,
244 'thread_cache_size' => '8',
245 'thread_stack' => '256K',
246 'tmpdir' => $mysql::params::tmpdir,
247 'user' => 'mysql',
248 },
249 'mysqldump' => {
250 'max_allowed_packet' => '16M',
251 'quick' => true,
252 'quote-names' => true,
253 },
254 'isamchk' => {
255 'key_buffer_size' => '16M',
256 },
257 }
258
259 }