annotate modules/mysql/manifests/server/managed_dirs.pp @ 454:d0e7979c7e8c

Update PHP configs for Ubuntu Mostly fixing some INI naming so that it is consistent between packages and what we write (so we don't end up with mixed/duplicate content)
author IBBoard <dev@ibboard.co.uk>
date Sun, 13 Aug 2023 15:26:37 +0100
parents 668df4711671
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
389
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 # @summary
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 # Binary log configuration requires the mysql user to be present. This must be done after package install.
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 #
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 # @api private
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 #
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 class mysql::server::managed_dirs {
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 $options = $mysql::server::_options
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 $includedir = $mysql::server::includedir
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 $managed_dirs = $mysql::server::managed_dirs
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 #Debian: Fix permission on directories
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 if $managed_dirs {
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 $managed_dirs_path = $managed_dirs.map |$path| { $options['mysqld']["${path}"] }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 $managed_dirs.each | $entry | {
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 $dir = $options['mysqld']["${entry}"]
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 if ( $dir and $dir != '/usr' and $dir != '/tmp' ) {
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 file { "${entry}-managed_dir":
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 ensure => directory,
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 path => $dir,
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 mode => '0700',
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 owner => $options['mysqld']['user'],
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 group => $options['mysqld']['user'],
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 } else {
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 $managed_dirs_path = []
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 $logbin = pick($options['mysqld']['log-bin'], $options['mysqld']['log_bin'], false)
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 if $logbin {
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 $logbindir = dirname($logbin)
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 #Stop puppet from managing directory if just a filename/prefix is specified or is not already managed
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 if (!($logbindir == '.' or $logbindir in $managed_dirs_path)) {
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 file { $logbindir:
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 ensure => directory,
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 mode => '0700',
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 owner => $options['mysqld']['user'],
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 group => $options['mysqld']['user'],
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 }
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 }