annotate modules/mysql/manifests/server/service.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 c6c9a2cfcfbd
children adf6fe9bbc17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
1 # @summary
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
2 # Private class for managing the MySQL service
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
3 #
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
4 # @api private
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 #
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 class mysql::server::service {
389
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents: 244
diff changeset
7 $options = $mysql::server::_options
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 if $mysql::server::real_service_manage {
26
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
10 if $mysql::server::real_service_enabled {
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
11 $service_ensure = 'running'
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
12 } else {
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
13 $service_ensure = 'stopped'
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 }
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
15 } else {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
16 $service_ensure = undef
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 }
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
19 if $mysql::server::override_options and $mysql::server::override_options['mysqld']
389
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents: 244
diff changeset
20 and $mysql::server::override_options['mysqld']['user'] {
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
21 $mysqluser = $mysql::server::override_options['mysqld']['user']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
22 } else {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
23 $mysqluser = $options['mysqld']['user']
26
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
24 }
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
25
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
26 if $mysql::server::real_service_manage {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
27 service { 'mysqld':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
28 ensure => $service_ensure,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
29 name => $mysql::server::service_name,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
30 enable => $mysql::server::real_service_enabled,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
31 provider => $mysql::server::service_provider,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
32 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
33
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
34 # only establish ordering between service and package if
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
35 # we're managing the package.
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
36 if $mysql::server::package_manage {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
37 Service['mysqld'] {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
38 require => Package['mysql-server'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
39 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
40 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
41
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
42 # only establish ordering between config file and service if
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
43 # we're managing the config file.
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
44 if $mysql::server::manage_config_file {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
45 File['mysql-config-file'] -> Service['mysqld']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
46 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
47
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
48 if $mysql::server::override_options and $mysql::server::override_options['mysqld']
389
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents: 244
diff changeset
49 and $mysql::server::override_options['mysqld']['socket'] {
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
50 $mysqlsocket = $mysql::server::override_options['mysqld']['socket']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
51 } else {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
52 $mysqlsocket = $options['mysqld']['socket']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
53 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
54
443
c6c9a2cfcfbd Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 389
diff changeset
55 $test_command = ['test', '-S', shell_escape($mysqlsocket)]
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
56 if $service_ensure != 'stopped' {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
57 exec { 'wait_for_mysql_socket_to_open':
443
c6c9a2cfcfbd Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 389
diff changeset
58 command => $test_command,
c6c9a2cfcfbd Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 389
diff changeset
59 unless => [$test_command],
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
60 tries => '3',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
61 try_sleep => '10',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
62 require => Service['mysqld'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
63 path => '/bin:/usr/bin',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
64 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
65 }
26
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
66 }
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 }