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 |
misc |
624 |
$pgsql_password = extlookup("sympa_pgsql",'x') |
26 |
misc |
1397 |
$ldap_password = extlookup("sympa_ldap",'x') |
27 |
misc |
551 |
|
28 |
misc |
1356 |
postgresql::remote_db_and_user { 'sympa': |
29 |
misc |
624 |
password => $pgsql_password, |
30 |
misc |
1356 |
description => "Sympa database", |
31 |
misc |
551 |
} |
32 |
misc |
1356 |
|
33 |
misc |
551 |
file { '/etc/sympa/sympa.conf': |
34 |
|
|
ensure => present, |
35 |
|
|
# should be cleaner to have it root owned, but puppet do not support acl |
36 |
|
|
# and in any case, config will be reset if it change |
37 |
|
|
owner => sympa, |
38 |
|
|
group => apache, |
39 |
|
|
mode => 640, |
40 |
|
|
content => template("sympa/sympa.conf") |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
file { '/etc/sympa/auth.conf': |
44 |
|
|
ensure => present, |
45 |
|
|
owner => root, |
46 |
|
|
group => root, |
47 |
|
|
mode => 644, |
48 |
misc |
571 |
content => template("sympa/auth.conf"), |
49 |
|
|
notify => Service['httpd'] |
50 |
misc |
551 |
} |
51 |
|
|
|
52 |
|
|
|
53 |
|
|
include apache::mod_fcgid |
54 |
|
|
apache::webapp_other{"sympa": |
55 |
misc |
560 |
webapp_file => "sympa/webapp_sympa.conf", |
56 |
misc |
551 |
} |
57 |
misc |
560 |
|
58 |
misc |
562 |
apache::vhost_redirect_ssl { "$vhost": } |
59 |
misc |
560 |
|
60 |
boklm |
1235 |
apache::vhost_base { "$vhost": |
61 |
|
|
use_ssl => true, |
62 |
|
|
content => template("sympa/vhost_ml.conf"), |
63 |
misc |
551 |
} |
64 |
misc |
1356 |
|
65 |
misc |
551 |
subversion::snapshot { "/etc/sympa/web_tt2": |
66 |
|
|
source => "svn://svn.mageia.org/svn/web/templates/sympa/trunk" |
67 |
|
|
} |
68 |
misc |
553 |
|
69 |
misc |
576 |
file { ["/etc/sympa/lists_xml/", |
70 |
misc |
578 |
"/etc/sympa/scenari/", |
71 |
misc |
576 |
"/etc/sympa/data_sources/", |
72 |
|
|
"/etc/sympa/search_filters/"]: |
73 |
misc |
553 |
ensure => directory, |
74 |
|
|
owner => root, |
75 |
|
|
group => root, |
76 |
|
|
mode => 755, |
77 |
misc |
635 |
purge => true, |
78 |
|
|
recurse => true, |
79 |
|
|
force => true, |
80 |
misc |
553 |
} |
81 |
misc |
569 |
|
82 |
misc |
588 |
file { ["/etc/sympa/scenari/subscribe.open_web_only_notify", |
83 |
|
|
"/etc/sympa/scenari/unsubscribe.open_web_only_notify"]: |
84 |
|
|
ensure => present, |
85 |
|
|
owner => root, |
86 |
|
|
group => root, |
87 |
|
|
mode => 755, |
88 |
|
|
source => "puppet:///modules/sympa/scenari/open_web_only_notify", |
89 |
|
|
} |
90 |
|
|
|
91 |
misc |
611 |
file { ["/etc/sympa/scenari/send.subscriber_moderated"]: |
92 |
|
|
ensure => present, |
93 |
|
|
owner => root, |
94 |
|
|
group => root, |
95 |
|
|
mode => 755, |
96 |
|
|
source => "puppet:///modules/sympa/scenari/subscriber_moderated", |
97 |
|
|
} |
98 |
|
|
|
99 |
misc |
690 |
file { ["/etc/sympa/scenari/create_list.forbidden"]: |
100 |
|
|
ensure => present, |
101 |
|
|
owner => root, |
102 |
|
|
group => root, |
103 |
|
|
mode => 755, |
104 |
|
|
source => "puppet:///modules/sympa/scenari/forbidden", |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
|
108 |
misc |
643 |
file { ["/etc/sympa/topics.conf"]: |
109 |
|
|
ensure => present, |
110 |
|
|
owner => root, |
111 |
|
|
group => root, |
112 |
|
|
mode => 755, |
113 |
|
|
source => "puppet:///modules/sympa/topics.conf", |
114 |
|
|
} |
115 |
|
|
|
116 |
misc |
576 |
define ldap_search_filter { |
117 |
misc |
604 |
file { "/etc/sympa/search_filters/$name.ldap": |
118 |
misc |
576 |
ensure => present, |
119 |
|
|
owner => root, |
120 |
|
|
group => root, |
121 |
|
|
mode => 755, |
122 |
misc |
587 |
content => template('sympa/search_filters/group.ldap') |
123 |
misc |
576 |
} |
124 |
|
|
} |
125 |
|
|
|
126 |
misc |
574 |
define ldap_group_datasource { |
127 |
misc |
598 |
file { "/etc/sympa/data_sources/$name.incl": |
128 |
misc |
574 |
ensure => present, |
129 |
|
|
owner => root, |
130 |
|
|
group => root, |
131 |
|
|
mode => 755, |
132 |
misc |
587 |
content => template('sympa/data_sources/ldap_group.incl') |
133 |
misc |
574 |
} |
134 |
|
|
} |
135 |
misc |
581 |
|
136 |
|
|
define scenario_sender_ldap_group { |
137 |
misc |
606 |
file { "/etc/sympa/scenari/send.restricted_$name": |
138 |
misc |
589 |
ensure => present, |
139 |
|
|
owner => root, |
140 |
|
|
group => root, |
141 |
|
|
mode => 755, |
142 |
|
|
content => template('sympa/scenari/sender.ldap_group') |
143 |
|
|
} |
144 |
misc |
581 |
} |
145 |
|
|
|
146 |
|
|
define scenario_sender_email { |
147 |
misc |
758 |
$sender_email_file = regsubst($name,'\@','-at-') |
148 |
|
|
file { "/etc/sympa/scenari/send.restricted_$sender_email_file": |
149 |
misc |
589 |
ensure => present, |
150 |
|
|
owner => root, |
151 |
|
|
group => root, |
152 |
|
|
mode => 755, |
153 |
|
|
content => template('sympa/scenari/sender.email') |
154 |
|
|
} |
155 |
misc |
581 |
} |
156 |
|
|
|
157 |
misc |
574 |
# add each group that could be used in a sympa ml either as |
158 |
|
|
# - owner |
159 |
|
|
# - editor ( moderation ) |
160 |
misc |
602 |
ldap_group_datasource { "mga-sysadmin": } |
161 |
misc |
574 |
ldap_group_datasource { "mga-ml_moderators": } |
162 |
|
|
|
163 |
misc |
576 |
|
164 |
misc |
569 |
# directory that will hold the list data |
165 |
|
|
# i am not sure of the name ( misc, 09/12/10 ) |
166 |
|
|
file { "/var/lib/sympa/expl/": |
167 |
|
|
ensure => directory, |
168 |
|
|
owner => sympa, |
169 |
|
|
group => root, |
170 |
|
|
mode => 755, |
171 |
|
|
} |
172 |
dmorgan |
234 |
} |
173 |
misc |
557 |
|
174 |
misc |
580 |
define list($subject, |
175 |
|
|
$profile = false, |
176 |
|
|
$language = 'en', |
177 |
misc |
644 |
$topics = false, |
178 |
misc |
580 |
$reply_to = false, |
179 |
|
|
$sender_email = false, |
180 |
|
|
$sender_ldap_group = false, |
181 |
|
|
$subscriber_ldap_group = false, |
182 |
misc |
1344 |
$public_archive = true, |
183 |
|
|
$subscription_open = false ) { |
184 |
misc |
557 |
|
185 |
misc |
562 |
include sympa::variable |
186 |
misc |
1396 |
$ldap_password = extlookup("sympa_ldap",'x') |
187 |
misc |
562 |
|
188 |
misc |
557 |
$xml_file = "/etc/sympa/lists_xml/$name.xml" |
189 |
|
|
|
190 |
misc |
607 |
if $sender_email { |
191 |
|
|
$sender_email_file = regsubst($sender_email,'\@','-at-') |
192 |
|
|
} else { |
193 |
|
|
$sender_email_file = '' |
194 |
|
|
} |
195 |
|
|
|
196 |
misc |
557 |
file { "$xml_file": |
197 |
|
|
owner => root, |
198 |
|
|
group => root, |
199 |
|
|
content => template('sympa/list.xml') |
200 |
|
|
} |
201 |
|
|
|
202 |
misc |
562 |
exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file": |
203 |
misc |
590 |
require => File["$xml_file"], |
204 |
misc |
592 |
creates => "/var/lib/sympa/expl/$name", |
205 |
misc |
580 |
before => File["/var/lib/sympa/expl/$name/config"], |
206 |
misc |
557 |
} |
207 |
misc |
580 |
|
208 |
|
|
file { "/var/lib/sympa/expl/$name/config": |
209 |
|
|
ensure => present, |
210 |
|
|
owner => sympa, |
211 |
|
|
group => sympa, |
212 |
|
|
mode => 750, |
213 |
|
|
content => template("sympa/config"), |
214 |
misc |
645 |
notify => Service['sympa'], |
215 |
misc |
580 |
} |
216 |
misc |
581 |
|
217 |
|
|
if $sender_ldap_group { |
218 |
|
|
if ! defined(Sympa::Server::Scenario_sender_ldap_group[$sender_ldap_group]) { |
219 |
|
|
sympa::server::scenario_sender_ldap_group { $sender_ldap_group: } |
220 |
|
|
} |
221 |
|
|
} |
222 |
|
|
|
223 |
|
|
if $sender_email { |
224 |
misc |
758 |
if ! defined(Sympa::Server::Scenario_sender_email[$sender_email]) { |
225 |
|
|
sympa::server::scenario_sender_email { $sender_email: } |
226 |
misc |
581 |
} |
227 |
|
|
} |
228 |
|
|
|
229 |
|
|
if $subscriber_ldap_group { |
230 |
|
|
if ! defined(Sympa::Server::Ldap_search_filter[$subscriber_ldap_group]) { |
231 |
|
|
sympa::server::ldap_search_filter { $subscriber_ldap_group: } |
232 |
|
|
} |
233 |
|
|
} |
234 |
misc |
557 |
} |
235 |
misc |
582 |
|
236 |
|
|
# |
237 |
|
|
# various types of list that can be directly used |
238 |
|
|
# |
239 |
|
|
# |
240 |
misc |
644 |
define public_list($subject, $language = 'en', $topics = false) { |
241 |
misc |
582 |
list { $name: |
242 |
|
|
subject => $subject, |
243 |
|
|
# profile => "public", |
244 |
|
|
language => $language, |
245 |
misc |
675 |
topics => $topics, |
246 |
misc |
582 |
} |
247 |
|
|
} |
248 |
|
|
|
249 |
|
|
# list where announce are sent by member of ldap_group |
250 |
|
|
# reply_to is set to $reply_to |
251 |
misc |
644 |
define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en', $topics = false) { |
252 |
misc |
582 |
# profile + scenario |
253 |
|
|
list{ $name: |
254 |
|
|
subject => $subject, |
255 |
|
|
profile => "", |
256 |
|
|
language => $language, |
257 |
misc |
675 |
topics => $topics, |
258 |
misc |
582 |
reply_to => $reply_to, |
259 |
|
|
sender_ldap_group => $sender_ldap_group, |
260 |
|
|
} |
261 |
|
|
} |
262 |
|
|
|
263 |
|
|
|
264 |
|
|
# list where announce are sent by $email only |
265 |
|
|
# reply_to is set to $reply_to |
266 |
misc |
644 |
define announce_list_email($subject, $reply_to, $sender_email, $language = 'en', $topics = false) { |
267 |
misc |
582 |
list{ $name: |
268 |
|
|
subject => $subject, |
269 |
|
|
profile => "", |
270 |
|
|
language => $language, |
271 |
misc |
675 |
topics => $topics, |
272 |
misc |
582 |
reply_to => $reply_to, |
273 |
|
|
sender_email => $sender_email, |
274 |
|
|
} |
275 |
|
|
} |
276 |
|
|
|
277 |
|
|
# list where people cannot subscribe, where people from $ldap_group receive |
278 |
|
|
# mail, with public archive |
279 |
misc |
644 |
define restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
280 |
misc |
582 |
list{ $name: |
281 |
|
|
subject => $subject, |
282 |
|
|
profile => "", |
283 |
misc |
675 |
topics => $topics, |
284 |
misc |
582 |
language => $language, |
285 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
286 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
287 |
|
|
} |
288 |
|
|
} |
289 |
|
|
|
290 |
misc |
1345 |
# list where only people from the ldap_group can post, ad where they are subscribe |
291 |
|
|
# by default, but anybody else can subscribe to read and receive messages |
292 |
|
|
define public_restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
293 |
|
|
list{ $name: |
294 |
|
|
subject => $subject, |
295 |
|
|
profile => "", |
296 |
|
|
topics => $topics, |
297 |
|
|
language => $language, |
298 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
299 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
300 |
|
|
subscription_open => true, |
301 |
|
|
} |
302 |
|
|
} |
303 |
|
|
|
304 |
|
|
|
305 |
misc |
582 |
# same as restricted list, but anybody can post |
306 |
misc |
644 |
define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
307 |
misc |
582 |
list{ $name: |
308 |
|
|
subject => $subject, |
309 |
|
|
profile => "", |
310 |
|
|
language => $language, |
311 |
misc |
675 |
topics => $topics, |
312 |
misc |
582 |
subscriber_ldap_group => $subscriber_ldap_group, |
313 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
314 |
|
|
} |
315 |
|
|
} |
316 |
|
|
|
317 |
|
|
# list with private archive, restricted to member of $ldap_group |
318 |
misc |
644 |
define private_list($subject, $subscriber_ldap_group, $language ='en', $topics = false) { |
319 |
misc |
582 |
list{ $name: |
320 |
|
|
subject => $subject, |
321 |
|
|
profile => "", |
322 |
|
|
language => $language, |
323 |
misc |
675 |
topics => $topics, |
324 |
misc |
582 |
subscriber_ldap_group => $subscriber_ldap_group, |
325 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
326 |
|
|
public_archive => false, |
327 |
|
|
} |
328 |
|
|
} |
329 |
|
|
|
330 |
|
|
# list with private archive, restricted to member of $ldap_group |
331 |
|
|
# everybody can post |
332 |
|
|
# used for contact alias |
333 |
misc |
644 |
define private_list_open($subject, $subscriber_ldap_group, $language ='en', $topics = false) { |
334 |
misc |
582 |
list{ $name: |
335 |
|
|
subject => $subject, |
336 |
|
|
profile => "", |
337 |
|
|
language => $language, |
338 |
misc |
675 |
topics => $topics, |
339 |
misc |
582 |
subscriber_ldap_group => $subscriber_ldap_group, |
340 |
|
|
public_archive => false, |
341 |
|
|
} |
342 |
|
|
} |
343 |
|
|
|
344 |
|
|
# same as private_list, but post are restricted to $email |
345 |
|
|
# ( scripting ) |
346 |
misc |
644 |
define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en', $topics = false) { |
347 |
misc |
582 |
list{ $name: |
348 |
|
|
subject => $subject, |
349 |
|
|
profile => "", |
350 |
|
|
language => $language, |
351 |
misc |
675 |
topics => $topics, |
352 |
misc |
582 |
subscriber_ldap_group => $subscriber_ldap_group, |
353 |
|
|
sender_email => $sender_email, |
354 |
|
|
public_archive => false, |
355 |
|
|
} |
356 |
|
|
} |
357 |
dmorgan |
234 |
} |
358 |
|
|
|