annotate modules/mysql/manifests/server/installdb.pp @ 244:48d3a1948e4d

Update MySQL module
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Dec 2019 14:11:43 -0500
parents
children 668df4711671
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 # @summary
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 # Builds initial databases on installation.
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 #
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 # @api private
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 #
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 class mysql::server::installdb {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 $options = $mysql::server::options
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 if $mysql::server::package_manage {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 # Build the initial databases.
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 $mysqluser = $mysql::server::options['mysqld']['user']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 $datadir = $mysql::server::options['mysqld']['datadir']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 $basedir = $mysql::server::options['mysqld']['basedir']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 $config_file = $mysql::server::config_file
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 $log_error = $mysql::server::options['mysqld']['log-error']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 if $mysql::server::manage_config_file and $config_file != $mysql::params::config_file {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 $_config_file=$config_file
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 } else {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 $_config_file=undef
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 if $options['mysqld']['log-error'] {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 file { $options['mysqld']['log-error']:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 ensure => present,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 owner => $mysqluser,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 group => $::mysql::server::mysql_group,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 mode => 'u+rw',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 before => Mysql_datadir[ $datadir ],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 mysql_datadir { $datadir:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 ensure => 'present',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 datadir => $datadir,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 basedir => $basedir,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 user => $mysqluser,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 log_error => $log_error,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 defaults_extra_file => $_config_file,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 if $mysql::server::restart {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 Mysql_datadir[$datadir] {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 notify => Class['mysql::server::service'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 }