blob: 6ffdad87ad66b1fbf3b83bbdb73b870fa9a21841 (
plain)
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
61
62
63
64
|
/*
== Definition: postfix::header_checks_snippet
Adds a header_checks snippets to /etc/postfix/header_checks.
See the postfix::header_checks class for details.
Parameters:
- *source* or *content*: source or content of the header_checks snippet
- *ensure*: present (default) or absent
Requires:
- Class["postfix"]
Example usage:
node "toto.example.com" {
include postfix
postfix::header_checks {
'wrong_date': content => 'FIXME';
'bla': source => 'puppet:///files/etc/postfix/header_checks.d/bla';
}
}
*/
define postfix::header_checks_snippet (
$ensure = "present",
$source = '',
$content = undef
) {
if $source == '' and $content == undef {
fail("One of \$source or \$content must be specified for postfix::header_checks_snippet ${name}")
}
if $source != '' and $content != undef {
fail("Only one of \$source or \$content must specified for postfix::header_checks_snippet ${name}")
}
if ($value == false) and ($ensure == "present") {
fail("The value parameter must be set when using the postfix::header_checks_snippet define with ensure=present.")
}
include postfix::header_checks
$fragment = "postfix_header_checks_${name}"
concat::fragment { "$fragment":
ensure => "$ensure",
target => '/etc/postfix/header_checks',
}
if $source {
Concat::Fragment["$fragment"] {
source => $source,
}
}
else {
Concat::Fragment["$fragment"] {
content => $content,
}
}
}
|