Puppet Class: ntp::params

Overview

Class: ntp::params

Defines some variables based on the operating system



6
7
8
9
10
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
# File 'manifests/params.pp', line 6

class ntp::params {

    include ::os::params

    case $::osfamily {
        'RedHat': {
            $driftfile = '/var/lib/ntp/ntp.drift'
            $pidfile = '/var/run/ntpd.pid'
            $service_name = 'ntpd'
            $service_opts = $::operatingsystemmajrelease ? {
                6       => "-p ${pidfile} -g -u ntp:ntp",
                7       => "-p ${pidfile} -g",
                21      => "-p ${pidfile} -g",
                default => "-p ${pidfile} -g",
            }
            $pool_directive = 'pool'
        }
        'Debian': {
            $driftfile = '/var/lib/ntp/ntp.drift'
            $pidfile = '/var/run/ntpd.pid'
            $service_name = 'ntp'
            $pool_directive = 'server'
        }
        'FreeBSD': {
            $driftfile = '/var/db/ntpd.drift'
            $pidfile = '/var/run/ntpd.pid'
            $service_name = 'ntpd'
            $pool_directive = 'server'
        }
        default: {
            fail("Unsupported operating system ${::osfamily}")
        }
    }

    if str2bool($::has_systemd) {
        $service_start = "${::os::params::systemctl} start ${service_name}"
        $service_stop = "${::os::params::systemctl} stop ${service_name}"
    } else {
        $service_start = "${::os::params::service_cmd} ${service_name} start"
        $service_stop = "${::os::params::service_cmd} ${service_name} stop"
    }

    # This can be used to work around startup scripts that don't have a proper
    # "status" target.
    $service_hasstatus = $::lsbdistcodename ? {
        default => true,
    }
}