Defined Type: postfix::canonical
- Defined in:
- manifests/canonical.pp
Overview
Definition: postfix::canonical
Manages content of the /etc/postfix/canonical map.
Parameters:
-
name: name of address postfix will lookup. See canonical(5).
-
destination: where the emails will be delivered to. See canonical(5).
-
ensure: present/absent, defaults to present.
Requires:
-
augeas
Example usage:
node "toto.example.com" {
include postfix
postfix::hash { "/etc/postfix/recipient_canonical":
ensure => present,
}
postfix::config { "canonical_alias_maps":
value => "hash:/etc/postfix/recipient_canonical"
}
postfix::canonical {
"user@example.com":
file => "/etc/postfix/recipient_canonical",
ensure => present,
destination => "root";
}
}
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 |
# File 'manifests/canonical.pp', line 36
define postfix::canonical (
$destination,
$file=undef,
$ensure='present'
) {
include postfix
include ::postfix::augeas
$_file = pick($file, "${postfix::confdir}/canonical")
case $ensure {
'present': {
$changes = [
"set pattern[. = '${name}'] '${name}'",
"set pattern[. = '${name}']/destination '${destination}'",
]
}
'absent': {
$changes = "rm pattern[. = '${name}']"
}
default: {
fail("Wrong ensure value: ${ensure}")
}
}
augeas {"Postfix canonical - ${name}":
incl => $_file,
lens => 'Postfix_Canonical.lns',
changes => $changes,
require => [Package['postfix'], Augeas::Lens['postfix_canonical']],
notify => Exec["generate ${_file}.db"],
}
}
|