1
2
3
4
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
|
define dovecot::config::file (
$ensure = present,
$source = 'absent',
$content = 'absent',
$destination = 'absent'
)
{
# the default destination is 'absent', so if the user doesn't specify a
# destination, then we use the following defaults. If different systems
# implement different locations, we can trigger here off of operatingsystem
# and change the 'config_dir' path in base.pp to just be /etc/dovecot
$real_destination = $destination ? {
'absent' => "${config_dir}/${name}",
default => $destination
}
# the $name variable is set to dovecot_${name}, but the actual filename will
# be set to $name
file { "dovecot_${name}":
ensure => $ensure,
path => $real_destination,
notify => Service[dovecot],
owner => root, group => 0, mode => 0640;
}
# the $content variable is 'absent' by default, so if the user doesn't
# specify anything for $content, then the following will be used, searching
# from the first source line until a file is found that matches. We use the
# standard search prioritizing the site-dovecot module first
case $content {
'absent': {
$real_source = $source ? {
'absent' => [
"puppet:///modules/site-dovecot/config/${fqdn}/${name}",
"puppet:///modules/site-dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}",
"puppet:///modules/site-dovecot/config/${operatingsystem}/${name}",
"puppet:///modules/site-dovecot/config/${name}",
"puppet:///modules/dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}",
"puppet:///modules/dovecot/config/${operatingsystem}/${name}",
"puppet:///modules/dovecot/config/${name}"
],
default => "puppet:///${source}",
}
File["dovecot_${name}"]{
source => $real_source,
}
}
default: {
File["dovecot_${name}"]{
content => $content,
}
}
}
File["dovecot_${name}"]{
require => Package[dovecot],
}
}
|