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 |
$ldap_password = extlookup("sympa_ldap",'x') |
27 |
|
28 |
postgresql::remote_db_and_user { 'sympa': |
29 |
password => $pgsql_password, |
30 |
description => "Sympa database", |
31 |
} |
32 |
|
33 |
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 |
require => Package[sympa], |
42 |
} |
43 |
|
44 |
file { '/etc/sympa/auth.conf': |
45 |
ensure => present, |
46 |
owner => root, |
47 |
group => root, |
48 |
mode => 644, |
49 |
content => template("sympa/auth.conf"), |
50 |
require => Package[sympa], |
51 |
notify => Service['httpd'], |
52 |
} |
53 |
|
54 |
|
55 |
include apache::mod_fcgid |
56 |
apache::webapp_other{"sympa": |
57 |
webapp_file => "sympa/webapp_sympa.conf", |
58 |
} |
59 |
|
60 |
apache::vhost_redirect_ssl { "$vhost": } |
61 |
|
62 |
apache::vhost_base { "$vhost": |
63 |
use_ssl => true, |
64 |
content => template("sympa/vhost_ml.conf"), |
65 |
} |
66 |
|
67 |
subversion::snapshot { "/etc/sympa/web_tt2": |
68 |
source => "svn://svn.mageia.org/svn/web/templates/sympa/trunk" |
69 |
} |
70 |
|
71 |
file { ["/etc/sympa/lists_xml/", |
72 |
"/etc/sympa/scenari/", |
73 |
"/etc/sympa/data_sources/", |
74 |
"/etc/sympa/search_filters/"]: |
75 |
ensure => directory, |
76 |
owner => root, |
77 |
group => root, |
78 |
mode => 755, |
79 |
purge => true, |
80 |
recurse => true, |
81 |
force => true, |
82 |
require => Package[sympa], |
83 |
} |
84 |
|
85 |
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 |
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 |
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 |
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 |
require => Package[sympa], |
118 |
} |
119 |
|
120 |
define ldap_search_filter { |
121 |
file { "/etc/sympa/search_filters/$name.ldap": |
122 |
ensure => present, |
123 |
owner => root, |
124 |
group => root, |
125 |
mode => 755, |
126 |
content => template('sympa/search_filters/group.ldap') |
127 |
} |
128 |
} |
129 |
|
130 |
define ldap_group_datasource { |
131 |
file { "/etc/sympa/data_sources/$name.incl": |
132 |
ensure => present, |
133 |
owner => root, |
134 |
group => root, |
135 |
mode => 755, |
136 |
content => template('sympa/data_sources/ldap_group.incl') |
137 |
} |
138 |
} |
139 |
|
140 |
define scenario_sender_ldap_group { |
141 |
file { "/etc/sympa/scenari/send.restricted_$name": |
142 |
ensure => present, |
143 |
owner => root, |
144 |
group => root, |
145 |
mode => 755, |
146 |
content => template('sympa/scenari/sender.ldap_group') |
147 |
} |
148 |
} |
149 |
|
150 |
define scenario_sender_email { |
151 |
$sender_email_file = regsubst($name,'\@','-at-') |
152 |
file { "/etc/sympa/scenari/send.restricted_$sender_email_file": |
153 |
ensure => present, |
154 |
owner => root, |
155 |
group => root, |
156 |
mode => 755, |
157 |
content => template('sympa/scenari/sender.email') |
158 |
} |
159 |
} |
160 |
|
161 |
# add each group that could be used in a sympa ml either as |
162 |
# - owner |
163 |
# - editor ( moderation ) |
164 |
ldap_group_datasource { "mga-sysadmin": } |
165 |
ldap_group_datasource { "mga-ml_moderators": } |
166 |
|
167 |
|
168 |
# 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 |
require => Package[sympa], |
176 |
} |
177 |
} |
178 |
|
179 |
define list($subject, |
180 |
$profile = false, |
181 |
$language = 'en', |
182 |
$topics = false, |
183 |
$reply_to = false, |
184 |
$sender_email = false, |
185 |
$sender_ldap_group = false, |
186 |
$subscriber_ldap_group = false, |
187 |
$public_archive = true, |
188 |
$subscription_open = false) { |
189 |
|
190 |
include sympa::variable |
191 |
$ldap_password = extlookup("sympa_ldap",'x') |
192 |
|
193 |
$xml_file = "/etc/sympa/lists_xml/$name.xml" |
194 |
|
195 |
if $sender_email { |
196 |
$sender_email_file = regsubst($sender_email,'\@','-at-') |
197 |
} else { |
198 |
$sender_email_file = '' |
199 |
} |
200 |
|
201 |
file { "$xml_file": |
202 |
owner => root, |
203 |
group => root, |
204 |
content => template('sympa/list.xml'), |
205 |
require => Package[sympa], |
206 |
} |
207 |
|
208 |
exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file": |
209 |
require => File["$xml_file"], |
210 |
creates => "/var/lib/sympa/expl/$name", |
211 |
before => File["/var/lib/sympa/expl/$name/config"], |
212 |
} |
213 |
|
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 |
notify => Service['sympa'], |
221 |
} |
222 |
|
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 |
if ! defined(Sympa::Server::Scenario_sender_email[$sender_email]) { |
231 |
sympa::server::scenario_sender_email { $sender_email: } |
232 |
} |
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 |
} |
241 |
|
242 |
# |
243 |
# various types of list that can be directly used |
244 |
# |
245 |
# |
246 |
define public_list($subject, $language = 'en', $topics = false) { |
247 |
list { $name: |
248 |
subject => $subject, |
249 |
# profile => "public", |
250 |
language => $language, |
251 |
topics => $topics, |
252 |
} |
253 |
} |
254 |
|
255 |
# list where announce are sent by member of ldap_group |
256 |
# reply_to is set to $reply_to |
257 |
define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en', $topics = false) { |
258 |
# profile + scenario |
259 |
list{ $name: |
260 |
subject => $subject, |
261 |
profile => "", |
262 |
language => $language, |
263 |
topics => $topics, |
264 |
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 |
define announce_list_email($subject, $reply_to, $sender_email, $language = 'en', $topics = false) { |
273 |
list{ $name: |
274 |
subject => $subject, |
275 |
profile => "", |
276 |
language => $language, |
277 |
topics => $topics, |
278 |
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 |
define restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
286 |
list{ $name: |
287 |
subject => $subject, |
288 |
profile => "", |
289 |
topics => $topics, |
290 |
language => $language, |
291 |
subscriber_ldap_group => $subscriber_ldap_group, |
292 |
sender_ldap_group => $subscriber_ldap_group, |
293 |
} |
294 |
} |
295 |
|
296 |
# 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 |
# same as restricted list, but anybody can post |
312 |
define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
313 |
list{ $name: |
314 |
subject => $subject, |
315 |
profile => "", |
316 |
language => $language, |
317 |
topics => $topics, |
318 |
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 |
define private_list($subject, $subscriber_ldap_group, $language ='en', $topics = false) { |
325 |
list{ $name: |
326 |
subject => $subject, |
327 |
profile => "", |
328 |
language => $language, |
329 |
topics => $topics, |
330 |
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 |
define private_list_open($subject, $subscriber_ldap_group, $language ='en', $topics = false) { |
340 |
list{ $name: |
341 |
subject => $subject, |
342 |
profile => "", |
343 |
language => $language, |
344 |
topics => $topics, |
345 |
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 |
define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en', $topics = false) { |
353 |
list{ $name: |
354 |
subject => $subject, |
355 |
profile => "", |
356 |
language => $language, |
357 |
topics => $topics, |
358 |
subscriber_ldap_group => $subscriber_ldap_group, |
359 |
sender_email => $sender_email, |
360 |
public_archive => false, |
361 |
} |
362 |
} |
363 |
} |
364 |
|