Puppet Class: postfix::mta
- Defined in:
- manifests/mta.pp
Overview
Class: postfix::mta
This class configures a minimal MTA, delivering mail to $mydestination.
Either a valid relay host or the special word ‘direct’ is required ($relayhost) for outbound email.
transport & virtual maps get configured and can be populated with postfix::transport and postfix::virtual
Parameters
- relayhost
-
(string) the relayhost to use or ‘direct’ to send mail directly without a relay.
-
- mydestination
-
(string)
-
- mynetworks
-
(string)
-
Examples
class { 'postfix':
relayhost => 'mail.example.com',
smtp_listen => '0.0.0.0',
mydestination => '$myorigin, myapp.example.com',
mta => true,
}
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 |
# File 'manifests/mta.pp', line 28
class postfix::mta (
Optional[Pattern[/^\S+(?:,\s*\S+)*$/]] $mydestination = undef,
Optional[Pattern[/^(?:\S+?(?:(?:,\s+)|(?:\s+))?)*$/]] $mynetworks = undef,
Optional[Pattern[/^\S+$/]] $relayhost = undef,
) {
include postfix
$_mydestination = pick($mydestination, $postfix::mydestination)
$_mynetworks = pick($mynetworks, $postfix::mynetworks)
$_relayhost = pick($relayhost, $postfix::relayhost)
# If direct is specified then relayhost should be blank
if ($_relayhost == 'direct') {
postfix::config { 'relayhost': ensure => 'blank' }
}
else {
postfix::config { 'relayhost': value => $_relayhost }
}
if ($_mydestination == 'blank') {
postfix::config { 'mydestination': ensure => 'blank' }
} else {
postfix::config { 'mydestination': value => $_mydestination }
}
postfix::config {
'mynetworks': value => $_mynetworks;
'virtual_alias_maps': value => "hash:${postfix::confdir}/virtual";
'transport_maps': value => "hash:${postfix::confdir}/transport";
}
postfix::hash { "${postfix::confdir}/virtual":
ensure => 'present',
}
postfix::hash { "${postfix::confdir}/transport":
ensure => 'present',
}
}
|