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