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