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
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
|
# File 'manifests/canonicalmap.pp', line 3
define postfix::canonicalmap(
$to_addr = $name,
$from_user = undef,
$from_domain = undef,
$from_address = undef,
$order = '55',
$include_to_maincf = true,
$target = '/etc/postfix/canonical',
) {
Exec {
path => '/bin:/sbin:/usr/bin:/usr/sbin',
}
if(! defined(Concat::Fragment["/etc/postfix/main.cf canonicalmap ${target}"]))
{
if($include_to_maincf)
{
concat::fragment{ "/etc/postfix/main.cf canonicalmap ${target}":
target => '/etc/postfix/main.cf',
order => '01',
content => "\n# canonical maps\ncanonical_maps = hash:${target}\n",
}
}
}
if(! defined(Concat[$target]))
{
concat { $target:
ensure => 'present',
owner => 'root',
group => 'root',
mode => '0644',
require => Package[$postfix::params::package_name],
notify => Exec["reload postfix canonicalmaps ${target}"],
}
exec { "reload postfix canonicalmaps ${target}":
command => "postmap ${target}",
refreshonly => true,
notify => Class['postfix::service'],
require => [ Package[$postfix::params::package_name], Concat["${postfix::params::baseconf}/canonical"] ],
}
concat::fragment{ "${target} header":
target => $target,
order => '00',
content => template("${module_name}/canonical/header.erb"),
}
}
if($from_user!=undef)
{
if($from_domain!=undef or $from_address!=undef)
{
fail('from_user, from_domain and from_address are mutually exclusive')
}
concat::fragment{ "${target} ${from_user} map ${to_addr}":
target => $target,
order => $order,
content => "${from_user} ${to_addr}\n",
}
}
if($from_domain!=undef)
{
if($from_user!=undef or $from_address!=undef)
{
fail('from_user, from_domain and from_address are mutually exclusive')
}
concat::fragment{ "${target} ${from_domain} map ${to_addr}":
target => $target,
order => $order,
content => "@${from_domain} ${to_addr}\n",
}
}
if($from_address!=undef)
{
if($from_user!=undef or $from_domain!=undef)
{
fail('from_user, from_domain and from_address are mutually exclusive')
}
concat::fragment{ "${target} ${from_address} map ${to_addr}":
target => $target,
order => $order,
content => "${from_address} ${to_addr}\n",
}
}
}
|