aboutsummaryrefslogtreecommitdiffstats
path: root/modules/postfix/manifests/init.pp
blob: 82eb496383193628ba9597200f91a484afbfa0eb (plain)
1
2
3
4
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
class postfix {

    class base {
        package { postfix:
            ensure => installed
        }
    	package { 'nail':
                ensure => installed
        }
        service { postfix:
            ensure => running,
            subscribe => [ Package['postfix']],
            path => "/etc/init.d/postfix"
        }
    }    

    file { '/etc/postfix/main.cf': 
        ensure => present, 
        owner => root, 
        group => root, 
        mode => 644, 
        require => Package["postfix"], 
        content => "", 
        notify => [Service['postfix']] 
    } 


    class simple_relay inherits base {
        file { '/etc/postfix/main.cf':
            content => template("postfix/simple_relay_main.cf"),
        }
    }

    class smtp_server inherits base {
        include postgrey
        include amavis
        include spamassassin
        file { '/etc/postfix/main.cf':
            content => template("postfix/main.cf"),
        }

        file { '/etc/postfix/transport_regexp':
            ensure => present,
            owner => root, 
            group => root, 
            mode => 644, 
            content => template("postfix/transport_regexp"),
        }

    }

    class primary_smtp inherits smtp_server {
        file { '/etc/postfix/master.cf':
            ensure => present,
            owner => root, 
            group => root, 
            mode => 644, 
            content => template("postfix/primary_master.cf"),
        }

        package { "postfix-ldap":
            ensure => installed
        }

        $aliases_group = ['mga-founders','mga-packagers','mga-sysadmin']        
        $ldap_password = extlookup("postfix_ldap",'x')
        file { '/etc/postfix/ldap_aliases.conf':
            ensure => present,
            owner => root, 
            group => root, 
            mode => 644, 
            content => template("postfix/ldap_aliases.conf"),
        }

        # TODO merge the file with the previous one, for common part (ldap, etc)
        file { '/etc/postfix/group_aliases.conf':
            ensure => present,
            owner => root, 
            group => root, 
            mode => 644, 
            content => template("postfix/group_aliases.conf"),
        }

        # TODO make it conditional to the presence of sympa
        file { '/etc/postfix/sympa_aliases':
            ensure => present,
            owner => root,
            group => root,
            mode => 644,
            content => template("postfix/sympa_aliases"),
        }




        file { '/etc/postfix/virtual_aliases':
            ensure => present,
            owner => root, 
            group => root, 
            mode => 644, 
            content => template("postfix/virtual_aliases"),
        }

        exec { "postmap /etc/postfix/virtual_aliases":
            refreshonly => true,
            subscribe => File['/etc/postfix/virtual_aliases'],
        }
    }


    class secondary_smtp inherits smtp_server {
    }

}