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
|
# File 'manifests/extconfigfile.pp', line 31
define dovecot::extconfigfile (
Hash[String, String] $entries,
Optional[String] $additional_content = undef,
String $relpath = $title,
Variant[Boolean, String] $warn = true,
Variant[Integer, String] $group = 0,
Variant[Integer, String] $mode = $dovecot::extconfigs_mode,
Variant[Integer, String] $owner = 'root',
) {
$_header = $warn ? {
true => "# This file is managed by Puppet. DO NOT EDIT.\n\n",
String => "${warn}\n",
default => '',
}
$_entries = String($entries, {
Hash => {
format => '% h',
separator => "\n",
separator2 => ' = ',
string_formats => { Any => '%s' },
}
})
if $additional_content {
$_additional_content = "${additional_content}\n"
} else {
$_additional_content = ''
}
$_content = "${_header}${_entries}\n${additional_content}"
file { "dovecot external config file ${title}":
path => "${dovecot::config_path}/${relpath}",
owner => $owner,
group => $group,
mode => $mode,
content => $_content,
require => Class['dovecot::install'],
notify => Class['dovecot::service'],
}
}
|