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/conf.pp', line 38
define nhc::conf (
Enum['present', 'absent'] $ensure = 'present',
Variant[Hash, Array] $checks = [],
Hash $settings = {},
Hash $settings_host = {},
Hash $config_overrides = {},
Boolean $detached_mode = false,
Boolean $detached_mode_fail_nodata = false,
String $program_name = $name,
Optional[Stdlib::Absolutepath] $conf_dir = undef,
Optional[Stdlib::Absolutepath] $conf_file = undef,
Optional[Stdlib::Absolutepath] $include_dir = undef,
Optional[Stdlib::Absolutepath] $sysconfig_path = undef,
Optional[Stdlib::Absolutepath] $log_file = undef,
) {
case $ensure {
'present': {
$directory_ensure = 'directory'
$_directory_force = undef
$file_ensure = 'file'
}
'absent': {
$directory_ensure = 'absent'
$_directory_force = true
$file_ensure = 'absent'
}
default: {}
}
include nhc
$_conf_dir = pick($conf_dir, $nhc::conf_dir)
$_conf_file = pick($conf_file, "${_conf_dir}/${name}.conf")
$_include_dir = pick($include_dir, $nhc::include_dir)
$_sysconfig_path = pick($sysconfig_path, "/etc/sysconfig/${name}")
$_log_file = pick($log_file, "/var/log/${name}.log")
$default_configs = {
'CONFDIR' => $_conf_dir,
'CONFFILE' => $_conf_file,
'DETACHED_MODE' => $detached_mode,
'DETACHED_MODE_FAIL_NODATA' => $detached_mode_fail_nodata,
'INCDIR' => $_include_dir,
'NAME' => $program_name,
}
$configs = merge($default_configs, $config_overrides)
if $_conf_dir != $nhc::conf_dir {
file { $_conf_dir:
ensure => $directory_ensure,
force => $_directory_force,
owner => 'root',
group => 'root',
mode => '0700',
require => Package['lbnl-nhc'],
}
}
if $_conf_file != $nhc::conf_file {
file { $_conf_file:
ensure => $file_ensure,
content => template('nhc/nhc.conf.erb'),
owner => 'root',
group => 'root',
mode => '0644',
require => File[$_conf_dir],
}
}
if $_include_dir != $nhc::include_dir {
file { $_include_dir:
ensure => $directory_ensure,
owner => 'root',
group => 'root',
mode => '0700',
require => Package['lbnl-nhc'],
}
}
if $_sysconfig_path != $nhc::sysconfig_path {
file { $_sysconfig_path:
ensure => $file_ensure,
content => template('nhc/sysconfig.erb'),
owner => 'root',
group => 'root',
mode => '0644',
}
}
}
|