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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'manifests/fetchcrl.pp', line 25
class osg::fetchcrl (
Enum['present', 'absent', 'disabled'] $ensure = 'present',
String $crl_package_name = 'fetch-crl',
String $crl_package_ensure = 'UNSET',
String $crl_boot_service_name = 'fetch-crl-boot',
String $crl_boot_service_ensure = 'stopped',
Boolean $crl_boot_service_enable = false,
String $crl_cron_service_name = 'fetch-crl-cron',
String $crl_cron_service_ensure = 'UNSET',
Variant[Boolean, Enum['UNSET']] $crl_cron_service_enable = 'UNSET',
Boolean $use_syslog = true,
) {
require 'osg'
case $ensure {
'present': {
$package_ensure_default = 'installed'
$syslog_conf_ensure = $use_syslog ? {
true => 'file',
false => 'absent',
}
$service_ensure_default = 'running'
$service_enable_default = true
}
'absent': {
$package_ensure_default = 'absent'
$syslog_conf_ensure = 'absent'
$service_ensure_default = 'stopped'
$service_enable_default = false
}
'disabled': {
$package_ensure_default = 'installed'
$syslog_conf_ensure = $use_syslog ? {
true => 'file',
false => 'absent',
}
$service_ensure_default = 'stopped'
$service_enable_default = false
}
default: {
fail("Module osg::fetchcrl: Parameter 'ensure' must be 'present', 'absent' or 'disabled': ${ensure} given")
}
}
$crl_package_ensure_real = $crl_package_ensure ? {
'UNSET' => $package_ensure_default,
default => $crl_package_ensure,
}
$crl_boot_service_ensure_real = $crl_boot_service_ensure ? {
'UNSET' => $service_ensure_default,
default => $crl_boot_service_ensure,
}
$crl_boot_service_enable_real = $crl_boot_service_enable ? {
'UNSET' => $service_enable_default,
default => $crl_boot_service_enable,
}
$crl_cron_service_ensure_real = $crl_cron_service_ensure ? {
'UNSET' => $service_ensure_default,
default => $crl_cron_service_ensure,
}
$crl_cron_service_enable_real = $crl_cron_service_enable ? {
'UNSET' => $service_enable_default,
default => $crl_cron_service_enable,
}
package { 'fetch-crl':
ensure => $crl_package_ensure_real,
name => $crl_package_name,
require => Yumrepo['osg'],
}
file { '/etc/fetch-crl.d/syslog.conf':
ensure => $syslog_conf_ensure,
owner => 'root',
group => 'root',
mode => '0644',
content => template('osg/fetchcrl/syslog.conf.erb'),
require => Package['fetch-crl'],
}
service { 'fetch-crl-boot':
ensure => $crl_boot_service_ensure_real,
enable => $crl_boot_service_enable_real,
name => $crl_boot_service_name,
hasstatus => true,
hasrestart => true,
require => Package['fetch-crl'],
}
service { 'fetch-crl-cron':
ensure => $crl_cron_service_ensure_real,
enable => $crl_cron_service_enable_real,
name => $crl_cron_service_name,
hasstatus => true,
hasrestart => true,
require => Package['fetch-crl'],
}
}
|