aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sympa/manifests/init.pp
blob: 8db00bdc8d2c37589971be9ff043d002bf71cf9f (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
class sympa {
    class variable {
        $vhost = "ml.$domain"
    }

    class server inherits variable {
        # perl-CGI-Fast is needed for fast cgi
        # perl-Socket6 is required by perl-IO-Socket-SSL
        #  (optional requirement)
        $package_list = ['sympa', 'sympa-www', 'perl-CGI-Fast',
                         'perl-Socket6']
    
        package { $package_list:
            ensure => installed;
        }
    
        # sympa script start 5 differents script, I am not
        # sure that puppet will correctly handle this
        service { "sympa":
            ensure => running,
            hasstatus => true,
            subscribe => [ Package["sympa"], File['/etc/sympa/sympa.conf']]
        }
    
        $password = extlookup("sympa_password",'x')
        $ldap_passwd = extlookup("sympa_ldap",'x')
    
        @@postgresql::user { 'sympa':
            password => $password,
        }
    
        file { '/etc/sympa/sympa.conf':
            ensure => present,
    	# should be cleaner to have it root owned, but puppet do not support acl
    	# and in any case, config will be reset if it change
            owner => sympa,
            group => apache,
            mode => 640,
            content => template("sympa/sympa.conf")
        }
    
        file { '/etc/sympa/auth.conf':
            ensure => present,
            owner => root,
            group => root,
            mode => 644,
            content => template("sympa/auth.conf"),
            notify => Service['httpd']
        }
    
    
        include apache::mod_fcgid
        apache::webapp_other{"sympa":
             webapp_file => "sympa/webapp_sympa.conf",
        }
   
        apache::vhost_redirect_ssl { "$vhost": }
 
        apache::vhost_other_app { "$vhost":
            vhost_file => "sympa/vhost_ml.conf",
        }

        openssl::self_signed_cert{ "$vhost":
            directory => "/etc/ssl/apache/"
        }
    

        @@postgresql::database { 'sympa':
            description => "Sympa database",
            user => "sympa",
            require => Postgresql::User["sympa"]
        }
    
        subversion::snapshot { "/etc/sympa/web_tt2":
            source => "svn://svn.mageia.org/svn/web/templates/sympa/trunk"
        }

        file { ["/etc/sympa/lists_xml/",
                "/etc/sympa/scenari/",
                "/etc/sympa/data_sources/",
                "/etc/sympa/search_filters/"]:
            ensure => directory,
            owner => root,
            group => root,
            mode => 755,
        }

        define ldap_search_filter {
            file { "/etc/sympa/search_filters/ldap-$name.ldap":
                ensure => present,
                owner => root,
                group => root,
                mode => 755,
                content => template('sympa/group.ldap') 
            }
        }

        define ldap_group_datasource {
            file { "/etc/sympa/data_sources/ldap-$name.incl":
                ensure => present,
                owner => root,
                group => root,
                mode => 755,
                content => template('sympa/ldap_group.incl') 
            }
        }
        # add each group that could be used in a sympa ml either as 
        # - owner
        # - editor ( moderation )
        ldap_group_datasource { "mga-sysadm": }
        ldap_group_datasource { "mga-ml_moderators": }

        ldap_search_filter { "mga-board": }

        # directory that will hold the list data
        # i am not sure of the name ( misc, 09/12/10 )
        file { "/var/lib/sympa/expl/":
            ensure => directory,
            owner => sympa,
            group => root,
            mode => 755,
        }
    }

    define list($subject, $profile, $language = 'en') {

        include sympa::variable

        $xml_file = "/etc/sympa/lists_xml/$name.xml"

        file { "$xml_file":
            owner => root,
            group => root,
            content => template('sympa/list.xml')    
        }

        exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file":
            refreshonly => true,
            subscribe => File["$xml_file"]
        }
    }
}