init.pp 1.93 KB
Newer Older
1
2
3
4
5
6
7
#
# == Class: postfix
#
# This class provides a basic setup of postfix with local and remote
# delivery and an SMTP server listening on the loopback interface.
#
# Parameters:
8
9
10
# - *$postfix_smtp_listen*: address on which the smtp service will listen to.
#      defaults to 127.0.0.1
# - *$root_mail_recipient*: who will recieve root's emails. defaults to 'nobody'
11
12
13
#
# Example usage:
#
14
15
#   node 'toto.example.com' {
#     $postfix_smtp_listen = '192.168.1.10'
16
17
18
#     include postfix
#   }
#
Raphaël Pinson's avatar
Linting    
Raphaël Pinson committed
19
20
21
class postfix (
  $smtp_listen = '127.0.0.1',         # postfix_smtp_listen
  $root_mail_recipient = 'nobody',    # root_mail_recipient
22
23
24
25
  $use_amavisd = false,               # postfix_use_amavisd
  $use_dovecot_lda = false,           # postfix_use_dovecot_lda
  $use_schleuder = false,             # postfix_use_schleuder
  $use_sympa = false,                 # postfix_use_sympa
Raphaël Pinson's avatar
Linting    
Raphaël Pinson committed
26
27
28
  $mail_user = 'vmail',               # postfix_mail_user
  $myorigin = $::fqdn,
  $inet_interfaces = 'localhost',
Raphaël Pinson's avatar
Raphaël Pinson committed
29
30
31
  $master_smtp = undef,               # postfix_master_smtp
  $master_smtps = undef,              # postfix_master_smtps
  $master_submission = undef,         # postfix_master_submission
Raphaël Pinson's avatar
Linting    
Raphaël Pinson committed
32
33
) inherits postfix::params {

34
35
36
37
  validate_bool($use_amavisd)
  validate_bool($use_dovecot_lda)
  validate_bool($use_schleuder)
  validate_bool($use_sympa)
Raphaël Pinson's avatar
Raphaël Pinson committed
38
39
40
41
42
  validate_string($mail_user)
  validate_string($myorigin)
  validate_string($inet_interfaces)
  validate_string($master_smtp)
  validate_string($master_smtps)
43

Raphaël Pinson's avatar
Linting    
Raphaël Pinson committed
44
  class { 'postfix::packages': } ->
Raphaël Pinson's avatar
Raphaël Pinson committed
45
46
47
48
49
50
51
52
53
54
55
  class { 'postfix::files':
    use_amavisd       => $use_amavisd,
    use_dovecot_lda   => $use_dovecot_lda,
    use_schleuder     => $use_schleuder,
    use_sympa         => $use_sympa,
    smtp_listen       => $smtp_listen,
    mail_user         => $mail_user,
    master_smtp       => $master_smtp,
    master_smtps      => $master_smtps,
    master_submission => $master_submission,
    } ~>
Raphaël Pinson's avatar
Linting    
Raphaël Pinson committed
56
57
  class { 'postfix::service': } ->
  Class['postfix']
58
}