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