Mercurial > repos > other > Puppet
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 |
rev | line source |
---|---|
244 | 1 # @summary |
2 # Private class for managing the MySQL service | |
3 # | |
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 | 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 | 15 } else { |
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 | 19 if $mysql::server::override_options and $mysql::server::override_options['mysqld'] |
389 | 20 and $mysql::server::override_options['mysqld']['user'] { |
244 | 21 $mysqluser = $mysql::server::override_options['mysqld']['user'] |
22 } else { | |
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 | 26 if $mysql::server::real_service_manage { |
27 service { 'mysqld': | |
28 ensure => $service_ensure, | |
29 name => $mysql::server::service_name, | |
30 enable => $mysql::server::real_service_enabled, | |
31 provider => $mysql::server::service_provider, | |
32 } | |
33 | |
34 # only establish ordering between service and package if | |
35 # we're managing the package. | |
36 if $mysql::server::package_manage { | |
37 Service['mysqld'] { | |
38 require => Package['mysql-server'], | |
39 } | |
40 } | |
41 | |
42 # only establish ordering between config file and service if | |
43 # we're managing the config file. | |
44 if $mysql::server::manage_config_file { | |
45 File['mysql-config-file'] -> Service['mysqld'] | |
46 } | |
47 | |
48 if $mysql::server::override_options and $mysql::server::override_options['mysqld'] | |
389 | 49 and $mysql::server::override_options['mysqld']['socket'] { |
244 | 50 $mysqlsocket = $mysql::server::override_options['mysqld']['socket'] |
51 } else { | |
52 $mysqlsocket = $options['mysqld']['socket'] | |
53 } | |
54 | |
443 | 55 $test_command = ['test', '-S', shell_escape($mysqlsocket)] |
244 | 56 if $service_ensure != 'stopped' { |
57 exec { 'wait_for_mysql_socket_to_open': | |
443 | 58 command => $test_command, |
59 unless => [$test_command], | |
244 | 60 tries => '3', |
61 try_sleep => '10', | |
62 require => Service['mysqld'], | |
63 path => '/bin:/usr/bin', | |
64 } | |
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 } |