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