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