files.pp 2.4 KB
Newer Older
1
class postfix::files {
2
3
  include postfix::params

4
5
6
7
8
9
10
  $alias_maps          = $postfix::all_alias_maps
  $inet_interfaces     = $postfix::inet_interfaces
  $mail_user           = $postfix::mail_user
  $master_smtp         = $postfix::master_smtp
  $master_smtps        = $postfix::master_smtps
  $master_submission   = $postfix::master_submission
  $myorigin            = $postfix::myorigin
11
  $root_mail_recipient = $postfix::root_mail_recipient
12
13
14
15
16
  $smtp_listen         = $postfix::_smtp_listen
  $use_amavisd         = $postfix::use_amavisd
  $use_dovecot_lda     = $postfix::use_dovecot_lda
  $use_schleuder       = $postfix::use_schleuder
  $use_sympa           = $postfix::use_sympa
17

18
19
20
21
22
23
24
25
26
  file { '/etc/mailname':
    ensure  => present,
    content => "${::fqdn}\n",
    seltype => $postfix::params::seltype,
  }

  # Aliases
  file { '/etc/aliases':
    ensure  => present,
Raphaël Pinson's avatar
Raphaël Pinson committed
27
    content => "# file managed by puppet\n",
28
    notify  => Exec['newaliases'],
29
30
31
32
33
34
35
36
37
38
39
40
    replace => false,
    seltype => $postfix::params::seltype,
  }

  # Aliases
  exec { 'newaliases':
    command     => '/usr/bin/newaliases',
    refreshonly => true,
    subscribe   => File['/etc/aliases'],
  }

  # Config files
41
42
43
44
45
  if $postfix::mastercf_source {
    $mastercf_content = undef
  } else {
    $mastercf_content = template(
        $postfix::params::master_os_template,
46
        'postfix/master.cf.common.erb'
47
48
49
      )
  }

50
51
  file { '/etc/postfix/master.cf':
    ensure  => present,
52
    content => $mastercf_content,
53
54
    group   => 'root',
    mode    => '0644',
55
    owner   => 'root',
56
    seltype => $postfix::params::seltype,
57
    source  => $postfix::mastercf_source,
58
59
60
61
62
63
64
  }

  # Config files
  file { '/etc/postfix/main.cf':
    ensure  => present,
    group   => 'root',
    mode    => '0644',
65
    owner   => 'root',
66
67
    replace => false,
    seltype => $postfix::params::seltype,
68
    source  => $postfix::maincf_source,
69
70
71
  }

  ::postfix::config {
Raphaël Pinson's avatar
Raphaël Pinson committed
72
    'alias_maps':       value => $alias_maps;
73
    'inet_interfaces':  value => $inet_interfaces;
74
    'myorigin':         value => $myorigin;
75
76
77
78
79
80
  }

  case $::osfamily {
    'RedHat': {
      ::postfix::config {
        'mailq_path':       value => '/usr/bin/mailq.postfix';
81
82
        'newaliases_path':  value => '/usr/bin/newaliases.postfix';
        'sendmail_path':    value => '/usr/sbin/sendmail.postfix';
83
84
85
86
87
88
      }
    }
    default: {}
  }

  mailalias {'root':
89
    recipient => $root_mail_recipient,
90
91
92
    notify    => Exec['newaliases'],
  }
}