mta.pp 1.67 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
#   }
#
Francois Deppierraz's avatar
Francois Deppierraz committed
33
class postfix::mta {
34

35
36
37
38
39
40
  validate_re($postfix::relayhost, '^\S+$',
              'You must pass $relayhost to the postfix class')
  validate_re($postfix::mydestination, '^\S+$',
              'You must pass $mydestination to the postfix class')
  validate_re($postfix::mynetworks, '^\S+$',
              'You must pass $mynetworks to the postfix class')
41

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

50
  postfix::hash { '/etc/postfix/virtual':
51
52
53
    ensure => present,
  }

54
  postfix::hash { '/etc/postfix/transport':
55
56
57
58
    ensure => present,
  }

}