1 |
dmorgan |
234 |
class sympa { |
2 |
misc |
562 |
class variable { |
3 |
|
|
$vhost = "ml.$domain" |
4 |
|
|
} |
5 |
|
|
|
6 |
|
|
class server inherits variable { |
7 |
misc |
551 |
# perl-CGI-Fast is needed for fast cgi |
8 |
|
|
# perl-Socket6 is required by perl-IO-Socket-SSL |
9 |
|
|
# (optional requirement) |
10 |
|
|
$package_list = ['sympa', 'sympa-www', 'perl-CGI-Fast', |
11 |
|
|
'perl-Socket6'] |
12 |
misc |
533 |
|
13 |
misc |
551 |
package { $package_list: |
14 |
|
|
ensure => installed; |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
# sympa script start 5 differents script, I am not |
18 |
|
|
# sure that puppet will correctly handle this |
19 |
|
|
service { "sympa": |
20 |
|
|
ensure => running, |
21 |
|
|
hasstatus => true, |
22 |
misc |
566 |
subscribe => [ Package["sympa"], File['/etc/sympa/sympa.conf']] |
23 |
misc |
551 |
} |
24 |
|
|
|
25 |
|
|
$password = extlookup("sympa_password",'x') |
26 |
|
|
$ldap_passwd = extlookup("sympa_ldap",'x') |
27 |
|
|
|
28 |
|
|
@@postgresql::user { 'sympa': |
29 |
|
|
password => $password, |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
file { '/etc/sympa/sympa.conf': |
33 |
|
|
ensure => present, |
34 |
|
|
# should be cleaner to have it root owned, but puppet do not support acl |
35 |
|
|
# and in any case, config will be reset if it change |
36 |
|
|
owner => sympa, |
37 |
|
|
group => apache, |
38 |
|
|
mode => 640, |
39 |
|
|
content => template("sympa/sympa.conf") |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
file { '/etc/sympa/auth.conf': |
43 |
|
|
ensure => present, |
44 |
|
|
owner => root, |
45 |
|
|
group => root, |
46 |
|
|
mode => 644, |
47 |
misc |
571 |
content => template("sympa/auth.conf"), |
48 |
|
|
notify => Service['httpd'] |
49 |
misc |
551 |
} |
50 |
|
|
|
51 |
|
|
|
52 |
|
|
include apache::mod_fcgid |
53 |
|
|
apache::webapp_other{"sympa": |
54 |
misc |
560 |
webapp_file => "sympa/webapp_sympa.conf", |
55 |
misc |
551 |
} |
56 |
misc |
560 |
|
57 |
misc |
562 |
apache::vhost_redirect_ssl { "$vhost": } |
58 |
misc |
560 |
|
59 |
misc |
562 |
apache::vhost_other_app { "$vhost": |
60 |
misc |
551 |
vhost_file => "sympa/vhost_ml.conf", |
61 |
|
|
} |
62 |
misc |
560 |
|
63 |
misc |
562 |
openssl::self_signed_cert{ "$vhost": |
64 |
misc |
560 |
directory => "/etc/ssl/apache/" |
65 |
|
|
} |
66 |
misc |
551 |
|
67 |
misc |
560 |
|
68 |
misc |
551 |
@@postgresql::database { 'sympa': |
69 |
|
|
description => "Sympa database", |
70 |
|
|
user => "sympa", |
71 |
|
|
require => Postgresql::User["sympa"] |
72 |
|
|
} |
73 |
|
|
|
74 |
|
|
subversion::snapshot { "/etc/sympa/web_tt2": |
75 |
|
|
source => "svn://svn.mageia.org/svn/web/templates/sympa/trunk" |
76 |
|
|
} |
77 |
misc |
553 |
|
78 |
misc |
576 |
file { ["/etc/sympa/lists_xml/", |
79 |
misc |
578 |
"/etc/sympa/scenari/", |
80 |
misc |
576 |
"/etc/sympa/data_sources/", |
81 |
|
|
"/etc/sympa/search_filters/"]: |
82 |
misc |
553 |
ensure => directory, |
83 |
|
|
owner => root, |
84 |
|
|
group => root, |
85 |
|
|
mode => 755, |
86 |
|
|
} |
87 |
misc |
569 |
|
88 |
misc |
588 |
file { ["/etc/sympa/scenari/subscribe.open_web_only_notify", |
89 |
|
|
"/etc/sympa/scenari/unsubscribe.open_web_only_notify"]: |
90 |
|
|
ensure => present, |
91 |
|
|
owner => root, |
92 |
|
|
group => root, |
93 |
|
|
mode => 755, |
94 |
|
|
source => "puppet:///modules/sympa/scenari/open_web_only_notify", |
95 |
|
|
} |
96 |
|
|
|
97 |
misc |
576 |
define ldap_search_filter { |
98 |
misc |
604 |
file { "/etc/sympa/search_filters/$name.ldap": |
99 |
misc |
576 |
ensure => present, |
100 |
|
|
owner => root, |
101 |
|
|
group => root, |
102 |
|
|
mode => 755, |
103 |
misc |
587 |
content => template('sympa/search_filters/group.ldap') |
104 |
misc |
576 |
} |
105 |
|
|
} |
106 |
|
|
|
107 |
misc |
574 |
define ldap_group_datasource { |
108 |
misc |
598 |
file { "/etc/sympa/data_sources/$name.incl": |
109 |
misc |
574 |
ensure => present, |
110 |
|
|
owner => root, |
111 |
|
|
group => root, |
112 |
|
|
mode => 755, |
113 |
misc |
587 |
content => template('sympa/data_sources/ldap_group.incl') |
114 |
misc |
574 |
} |
115 |
|
|
} |
116 |
misc |
581 |
|
117 |
|
|
define scenario_sender_ldap_group { |
118 |
misc |
606 |
file { "/etc/sympa/scenari/send.restricted_$name": |
119 |
misc |
589 |
ensure => present, |
120 |
|
|
owner => root, |
121 |
|
|
group => root, |
122 |
|
|
mode => 755, |
123 |
|
|
content => template('sympa/scenari/sender.ldap_group') |
124 |
|
|
} |
125 |
misc |
581 |
} |
126 |
|
|
|
127 |
|
|
define scenario_sender_email { |
128 |
misc |
606 |
file { "/etc/sympa/scenari/send.restricted_$name": |
129 |
misc |
589 |
ensure => present, |
130 |
|
|
owner => root, |
131 |
|
|
group => root, |
132 |
|
|
mode => 755, |
133 |
|
|
content => template('sympa/scenari/sender.email') |
134 |
|
|
} |
135 |
misc |
581 |
} |
136 |
|
|
|
137 |
misc |
574 |
# add each group that could be used in a sympa ml either as |
138 |
|
|
# - owner |
139 |
|
|
# - editor ( moderation ) |
140 |
misc |
602 |
ldap_group_datasource { "mga-sysadmin": } |
141 |
misc |
574 |
ldap_group_datasource { "mga-ml_moderators": } |
142 |
|
|
|
143 |
misc |
576 |
|
144 |
misc |
569 |
# directory that will hold the list data |
145 |
|
|
# i am not sure of the name ( misc, 09/12/10 ) |
146 |
|
|
file { "/var/lib/sympa/expl/": |
147 |
|
|
ensure => directory, |
148 |
|
|
owner => sympa, |
149 |
|
|
group => root, |
150 |
|
|
mode => 755, |
151 |
|
|
} |
152 |
dmorgan |
234 |
} |
153 |
misc |
557 |
|
154 |
misc |
580 |
define list($subject, |
155 |
|
|
$profile = false, |
156 |
|
|
$language = 'en', |
157 |
|
|
$reply_to = false, |
158 |
|
|
$sender_email = false, |
159 |
|
|
$sender_ldap_group = false, |
160 |
|
|
$subscriber_ldap_group = false, |
161 |
|
|
$public_archive = true ) { |
162 |
misc |
557 |
|
163 |
misc |
562 |
include sympa::variable |
164 |
|
|
|
165 |
misc |
557 |
$xml_file = "/etc/sympa/lists_xml/$name.xml" |
166 |
|
|
|
167 |
|
|
file { "$xml_file": |
168 |
|
|
owner => root, |
169 |
|
|
group => root, |
170 |
|
|
content => template('sympa/list.xml') |
171 |
|
|
} |
172 |
|
|
|
173 |
misc |
562 |
exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file": |
174 |
misc |
590 |
require => File["$xml_file"], |
175 |
misc |
592 |
creates => "/var/lib/sympa/expl/$name", |
176 |
misc |
580 |
before => File["/var/lib/sympa/expl/$name/config"], |
177 |
misc |
557 |
} |
178 |
misc |
580 |
|
179 |
|
|
file { "/var/lib/sympa/expl/$name/config": |
180 |
|
|
ensure => present, |
181 |
|
|
owner => sympa, |
182 |
|
|
group => sympa, |
183 |
|
|
mode => 750, |
184 |
|
|
content => template("sympa/config"), |
185 |
|
|
} |
186 |
misc |
581 |
|
187 |
|
|
if $sender_ldap_group { |
188 |
|
|
if ! defined(Sympa::Server::Scenario_sender_ldap_group[$sender_ldap_group]) { |
189 |
|
|
sympa::server::scenario_sender_ldap_group { $sender_ldap_group: } |
190 |
|
|
} |
191 |
|
|
} |
192 |
|
|
|
193 |
|
|
if $sender_email { |
194 |
|
|
if ! defined(Sympa::Server::Scenario_sender_email[$sender_email]) { |
195 |
|
|
sympa::server::scenario_sender_email { $sender_email: } |
196 |
|
|
} |
197 |
|
|
} |
198 |
|
|
|
199 |
|
|
if $subscriber_ldap_group { |
200 |
|
|
if ! defined(Sympa::Server::Ldap_search_filter[$subscriber_ldap_group]) { |
201 |
|
|
sympa::server::ldap_search_filter { $subscriber_ldap_group: } |
202 |
|
|
} |
203 |
|
|
} |
204 |
misc |
557 |
} |
205 |
misc |
582 |
|
206 |
|
|
# |
207 |
|
|
# various types of list that can be directly used |
208 |
|
|
# |
209 |
|
|
# |
210 |
|
|
define public_list($subject, $language = 'en') { |
211 |
|
|
list { $name: |
212 |
|
|
subject => $subject, |
213 |
|
|
# profile => "public", |
214 |
|
|
language => $language, |
215 |
|
|
} |
216 |
|
|
} |
217 |
|
|
|
218 |
|
|
# list where announce are sent by member of ldap_group |
219 |
|
|
# reply_to is set to $reply_to |
220 |
|
|
define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en') { |
221 |
|
|
# profile + scenario |
222 |
|
|
list{ $name: |
223 |
|
|
subject => $subject, |
224 |
|
|
profile => "", |
225 |
|
|
language => $language, |
226 |
|
|
reply_to => $reply_to, |
227 |
|
|
sender_ldap_group => $sender_ldap_group, |
228 |
|
|
} |
229 |
|
|
} |
230 |
|
|
|
231 |
|
|
|
232 |
|
|
# list where announce are sent by $email only |
233 |
|
|
# reply_to is set to $reply_to |
234 |
|
|
define announce_list_email($subject, $reply_to, $sender_email, $language = 'en') { |
235 |
|
|
list{ $name: |
236 |
|
|
subject => $subject, |
237 |
|
|
profile => "", |
238 |
|
|
language => $language, |
239 |
|
|
reply_to => $reply_to, |
240 |
|
|
sender_email => $sender_email, |
241 |
|
|
} |
242 |
|
|
} |
243 |
|
|
|
244 |
|
|
# list where people cannot subscribe, where people from $ldap_group receive |
245 |
|
|
# mail, with public archive |
246 |
|
|
define restricted_list($subject, $subscriber_ldap_group, $language = 'en') { |
247 |
|
|
list{ $name: |
248 |
|
|
subject => $subject, |
249 |
|
|
profile => "", |
250 |
|
|
language => $language, |
251 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
252 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
253 |
|
|
} |
254 |
|
|
} |
255 |
|
|
|
256 |
|
|
# same as restricted list, but anybody can post |
257 |
|
|
define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en') { |
258 |
|
|
list{ $name: |
259 |
|
|
subject => $subject, |
260 |
|
|
profile => "", |
261 |
|
|
language => $language, |
262 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
263 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
264 |
|
|
} |
265 |
|
|
} |
266 |
|
|
|
267 |
|
|
# list with private archive, restricted to member of $ldap_group |
268 |
|
|
define private_list($subject, $subscriber_ldap_group, $language ='en') { |
269 |
|
|
list{ $name: |
270 |
|
|
subject => $subject, |
271 |
|
|
profile => "", |
272 |
|
|
language => $language, |
273 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
274 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
275 |
|
|
public_archive => false, |
276 |
|
|
} |
277 |
|
|
} |
278 |
|
|
|
279 |
|
|
# list with private archive, restricted to member of $ldap_group |
280 |
|
|
# everybody can post |
281 |
|
|
# used for contact alias |
282 |
|
|
define private_list_open($subject, $subscriber_ldap_group, $language ='en') { |
283 |
|
|
list{ $name: |
284 |
|
|
subject => $subject, |
285 |
|
|
profile => "", |
286 |
|
|
language => $language, |
287 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
288 |
|
|
public_archive => false, |
289 |
|
|
} |
290 |
|
|
} |
291 |
|
|
|
292 |
|
|
# same as private_list, but post are restricted to $email |
293 |
|
|
# ( scripting ) |
294 |
|
|
define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en') { |
295 |
|
|
list{ $name: |
296 |
|
|
subject => $subject, |
297 |
|
|
profile => "", |
298 |
|
|
language => $language, |
299 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
300 |
|
|
sender_email => $sender_email, |
301 |
|
|
public_archive => false, |
302 |
|
|
} |
303 |
|
|
} |
304 |
dmorgan |
234 |
} |
305 |
|
|
|