Puppet Class: mariadb::service

Defined in:
modules/mariadb/manifests/service.pp

Overview

Parameters:

  • manage (Boolean) (defaults to: false)
  • ensure (Stdlib::Ensure::Service) (defaults to: stopped)
  • enable (Wmflib::Enable_Service) (defaults to: false)
  • override (Optional[String]) (defaults to: undef)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'modules/mariadb/manifests/service.pp', line 11

class mariadb::service (
    Boolean $manage                 = false,
    Stdlib::Ensure::Service $ensure = stopped,
    Wmflib::Enable_Service $enable  = false,
    Optional[String] $override      = undef,
) {

    # TODO: use the base::service configuration
    if $manage {
        service { 'mariadb':
            # $manage assumes only the main instance is managed-
            # multiple instances have to be managed manually
            ensure => $ensure,
            enable => $enable,
        }
    }
    # handle per-host special configuration
    if $override {
        file { '/etc/systemd/system/mariadb.service.d':
            ensure => directory,
            mode   => '0755',
            owner  => 'root',
            group  => 'root',
        }
        file { '/etc/systemd/system/mariadb.service.d/override.conf':
            ensure  => present,
            mode    => '0644',
            owner   => 'root',
            group   => 'root',
            content => $override,
            notify  => Exec['systemctl-daemon-reload'],
        }
        exec { 'systemctl-daemon-reload':
            command     => '/bin/systemctl daemon-reload',
            refreshonly => true,
        }
    } else {
        file { '/etc/systemd/system/mariadb.service.d/override.conf':
            ensure => absent,
            notify => File['/etc/systemd/system/mariadb.service.d']
        }
        file { '/etc/systemd/system/mariadb.service.d':
            ensure => absent,
        }
    }
}