Puppet Class: postfix

Defined in:
puppet/modules/postfix/manifests/init.pp

Overview

Class: postfix

Postfix MTA service



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'puppet/modules/postfix/manifests/init.pp', line 5

class postfix {

    # T160660: Upgrade openssl before installing postfix.
    # Note: ensure => latest here is gross but there really isn't another way
    # to handle this unless we switch to using an exec block and actually
    # checking the currently installed version against some minimum.
    package { 'openssl':
        ensure          => 'latest',
        before          => Package['postfix'],
        install_options => [ '--force-yes' ],
    }

    package { ['postfix', 'postfix-pcre']: }

    file { '/etc/postfix':
        ensure  => directory,
        owner   => 'root',
        group   => 'root',
        mode    => '0755',
        require => Package['postfix'],
    }

    file { '/etc/postfix/main.cf':
        content => template('postfix/main.cf.erb'),
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
    }

    file { '/etc/postfix/virtual':
        content => template('postfix/virtual.erb'),
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
    }

    file { '/etc/postfix/aliases':
        content => '',
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
    }

    exec { 'postmap_virtual':
        command     => 'postmap /etc/postfix/virtual',
        subscribe   => File['/etc/postfix/virtual'],
        refreshonly => true,
    }

    exec { 'postmap_aliases':
        command     => 'postalias /etc/postfix/aliases',
        subscribe   => File['/etc/postfix/aliases'],
        refreshonly => true,
    }

    service { 'postfix':
        ensure    => running,
        enable    => true,
        subscribe => [
            File['/etc/postfix/main.cf'],
            Exec['postmap_virtual'],
        ],
    }
}