mta.pp 1.68 KB
Newer Older
1
2
#
# == Class: postfix::mta
3
4
#
# This class configures a minimal MTA, listening on
5
# $postfix_smtp_listen (default to localhost) and delivering mail to
6
7
8
9
10
# $postfix_mydestination (default to $fqdn).
#
# A valid relay host is required ($postfix_relayhost) for outbound email.
#
# transport & virtual maps get configured and can be populated with
Francois Deppierraz's avatar
Francois Deppierraz committed
11
# postfix::transport and postfix::virtual
12
#
13
14
15
# Parameters:
# - *$postfix_relayhost*
# - *$postfix_mydestination*
16
# - every global variable which works for class 'postfix' will work here.
17
18
#
# Example usage:
19
#
20
21
22
#   node 'toto.example.com' {
#     $postfix_relayhost = 'mail.example.com'
#     $postfix_smtp_listen = '0.0.0.0'
23
#     $postfix_mydestination = '$myorigin, myapp.example.com'
24
#
25
#     include postfix::mta
26
#
27
#     postfix::transport { 'myapp.example.com':
28
#       ensure => present,
29
#       destination => 'local:',
30
#     }
31
32
#   }
#
33
34
35
36
class postfix::mta (
  $mydestination = $postfix::mydestination,
  $mynetworks = $postfix::mynetworks,
) {
37

38
39
  validate_re($postfix::relayhost, '^\S+$',
              'You must pass $relayhost to the postfix class')
40
  validate_re($mydestination, '^\S+$',
41
42
43
              'Wrong value for $mydestination')
  validate_re($mynetworks, '^\S+$',
              'Wrong value for $mynetworks')
44

Francois Deppierraz's avatar
Francois Deppierraz committed
45
  postfix::config {
46
    'mydestination':       value => $mydestination;
47
    'mynetworks':          value => $mynetworks;
48
    'relayhost':           value => $postfix::relayhost;
49
50
    'virtual_alias_maps':  value => 'hash:/etc/postfix/virtual';
    'transport_maps':      value => 'hash:/etc/postfix/transport';
51
52
  }

53
  postfix::hash { '/etc/postfix/virtual':
54
55
56
    ensure => present,
  }

57
  postfix::hash { '/etc/postfix/transport':
58
59
60
61
    ensure => present,
  }

}