mta.pp 1.45 KB
Newer Older
1
# == Class: postfix::mta
2
#
Raphaël Pinson's avatar
Doc    
Raphaël Pinson committed
3
4
# This class configures a minimal MTA, delivering mail to
# $mydestination.
5
#
Raphaël Pinson's avatar
Doc    
Raphaël Pinson committed
6
# A valid relay host is required ($relayhost) for outbound email.
7
8
#
# transport & virtual maps get configured and can be populated with
Francois Deppierraz's avatar
Francois Deppierraz committed
9
# postfix::transport and postfix::virtual
10
#
Raphaël Pinson's avatar
Doc    
Raphaël Pinson committed
11
# === Parameters
12
#
Raphaël Pinson's avatar
Doc    
Raphaël Pinson committed
13
14
15
# [*relayhost*]     - (string) the relayhost to use
# [*mydestination*] - (string)
# [*mynetworks*]    - (string)
16
#
Raphaël Pinson's avatar
Doc    
Raphaël Pinson committed
17
# === Examples
18
#
Raphaël Pinson's avatar
Doc    
Raphaël Pinson committed
19
20
21
22
23
#   class { 'postfix':
#     relayhost     => 'mail.example.com',
#     smtp_listen   => '0.0.0.0',
#     mydestination => '$myorigin, myapp.example.com',
#     mta           => true,
24
25
#   }
#
26
27
class postfix::mta (
  $mydestination = $postfix::mydestination,
28
29
  $mynetworks    = $postfix::mynetworks,
  $relayhost     = $postfix::relayhost,
30
) {
31

32
33
  validate_re($relayhost, '^\S+$',
              'Wrong value for $relayhost')
34
  validate_re($mydestination, '^\S+$',
35
36
37
              'Wrong value for $mydestination')
  validate_re($mynetworks, '^\S+$',
              'Wrong value for $mynetworks')
38

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

47
  postfix::hash { '/etc/postfix/virtual':
Raphaël Pinson's avatar
Raphaël Pinson committed
48
    ensure => 'present',
49
50
  }

51
  postfix::hash { '/etc/postfix/transport':
Raphaël Pinson's avatar
Raphaël Pinson committed
52
    ensure => 'present',
53
54
55
  }

}