Puppet Class: znapzend::config

Defined in:
manifests/config.pp

Overview

This class is called from znapzend for service config.



5
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
54
55
56
57
58
59
60
61
62
# File 'manifests/config.pp', line 5

class znapzend::config {
  assert_private('znapzend::config is a private class')

  $_service_options = $znapzend::service_options
  $_service_systemd_afters = $znapzend::service_systemd_afters
  $_znapzend_linkpath = $znapzend::znapzend_linkpath
  file { '/etc/default/znapzend':
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template($znapzend::service_options_template),
  }

  file { $znapzend::plan_confdir_setup:
    ensure => directory,
    purge  => $znapzend::plan_confdir_purge,
  }
  case $::osfamily {
    'RedHat': {
      case $::operatingsystemmajrelease {
        '6': {
          file { "/etc/init.d/${znapzend::service_name}":
            ensure  => present,
            owner   => 'root',
            group   => 'root',
            mode    => '0755',
            content => template($znapzend::service_sysv_template),
            notify  => Exec['znapzend_add_sysv_service'],
          }
          exec { 'znapzend_add_sysv_service':
            command     => "/sbin/chkconfig --add ${znapzend::service_name}",
            refreshonly => true,
            unless      => "/bin/ls /etc/rc* | /bin/grep ${znapzend::service_name}",
          }
        }
        '7': {
          include ::systemd::systemctl::daemon_reload

          file { '/etc/systemd/system/znapzend.service':
            ensure  => present,
            owner   => 'root',
            group   => 'root',
            mode    => '0644',
            content => template($znapzend::service_systemd_template),
            require => File['/etc/default/znapzend'],
          } ~> Class['systemd::systemctl::daemon_reload']
        }
        default: {
          fail("${::operatingsystem} ${::operatingsystemmajrelease} not supported")
        }
      }
    }
    default: {
      fail("${::osfamily} not supported")
    }
  }
}