aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sympa/manifests/init.pp
blob: 2ce851ea33832137488fededd194bb423ed27f2e (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
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 { ['sympa', 'sympa-www', 'perl-CGI-Fast',
                   'perl-Socket6']: }

        # sympa script start 5 differents script, I am not
        # sure that puppet will correctly handle this
        service { "sympa":
            subscribe => [ Package["sympa"], File['/etc/sympa/sympa.conf']]
        }

        $pgsql_password = extlookup("sympa_pgsql",'x')
        $ldap_password = extlookup("sympa_ldap",'x')

        postgresql::remote_db_and_user { 'sympa':
            password => $pgsql_password,
            description => "Sympa database",
        }

        File {
            require => Package['sympa'],
        }

        file { '/etc/sympa/sympa.conf':
    	# 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':
            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_base { "$vhost":
            use_ssl => true,
            content => template("sympa/vhost_ml.conf"),
        }

        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,
            purge => true,
            recurse => true,
            force => true,
        }

        file {
            "/etc/sympa/scenari/subscribe.open_web_only_notify":
                source => "puppet:///modules/sympa/scenari/open_web_only_notify";
            "/etc/sympa/scenari/unsubscribe.open_web_only_notify":
                source => "puppet:///modules/sympa/scenari/open_web_only_notify";
            "/etc/sympa/scenari/send.subscriber_moderated":
                source => "puppet:///modules/sympa/scenari/subscriber_moderated";
            "/etc/sympa/scenari/create_list.forbidden":
                source => "puppet:///modules/sympa/scenari/forbidden";
            "/etc/sympa/topics.conf":
                source => "puppet:///modules/sympa/topics.conf";
        }

        define ldap_search_filter {
            file { "/etc/sympa/search_filters/$name.ldap":
                content => template('sympa/search_filters/group.ldap')
            }
        }

        define ldap_group_datasource {
            file { "/etc/sympa/data_sources/$name.incl":
                content => template('sympa/data_sources/ldap_group.incl')
            }
        }

        define scenario_sender_ldap_group {
            file { "/etc/sympa/scenari/send.restricted_$name":
                content => template('sympa/scenari/sender.ldap_group')
            }
        }

        define scenario_sender_email {
            $sender_email_file = regsubst($name,'\@','-at-')
            file { "/etc/sympa/scenari/send.restricted_$sender_email_file":
                content => template('sympa/scenari/sender.email')
            }
        }

        # add each group that could be used in a sympa ml either as
        # - owner
        # - editor ( moderation )
        ldap_group_datasource { "mga-sysadmin": }
        ldap_group_datasource { "mga-ml_moderators": }


        # 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,
        }
    }
}