1 |
dmorgan |
234 |
class sympa { |
2 |
misc |
562 |
class variable { |
3 |
|
|
$vhost = "ml.$domain" |
4 |
|
|
} |
5 |
|
|
|
6 |
|
|
class server inherits variable { |
7 |
misc |
551 |
# perl-CGI-Fast is needed for fast cgi |
8 |
|
|
# perl-Socket6 is required by perl-IO-Socket-SSL |
9 |
|
|
# (optional requirement) |
10 |
misc |
2295 |
package { ['sympa', 'sympa-www', 'perl-CGI-Fast', |
11 |
|
|
'perl-Socket6']: } |
12 |
|
|
|
13 |
misc |
551 |
# sympa script start 5 differents script, I am not |
14 |
|
|
# sure that puppet will correctly handle this |
15 |
|
|
service { "sympa": |
16 |
misc |
566 |
subscribe => [ Package["sympa"], File['/etc/sympa/sympa.conf']] |
17 |
misc |
551 |
} |
18 |
misc |
2605 |
|
19 |
misc |
624 |
$pgsql_password = extlookup("sympa_pgsql",'x') |
20 |
misc |
1397 |
$ldap_password = extlookup("sympa_ldap",'x') |
21 |
misc |
2605 |
|
22 |
misc |
1356 |
postgresql::remote_db_and_user { 'sympa': |
23 |
misc |
624 |
password => $pgsql_password, |
24 |
misc |
1356 |
description => "Sympa database", |
25 |
misc |
551 |
} |
26 |
misc |
2296 |
|
27 |
|
|
File { |
28 |
|
|
require => Package['sympa'], |
29 |
|
|
} |
30 |
|
|
|
31 |
misc |
551 |
file { '/etc/sympa/sympa.conf': |
32 |
|
|
# should be cleaner to have it root owned, but puppet do not support acl |
33 |
|
|
# and in any case, config will be reset if it change |
34 |
|
|
owner => sympa, |
35 |
|
|
group => apache, |
36 |
|
|
mode => 640, |
37 |
misc |
1967 |
content => template("sympa/sympa.conf"), |
38 |
misc |
551 |
} |
39 |
misc |
2605 |
|
40 |
misc |
551 |
file { '/etc/sympa/auth.conf': |
41 |
misc |
571 |
content => template("sympa/auth.conf"), |
42 |
misc |
1967 |
notify => Service['httpd'], |
43 |
misc |
551 |
} |
44 |
misc |
2605 |
|
45 |
|
|
|
46 |
misc |
551 |
include apache::mod_fcgid |
47 |
|
|
apache::webapp_other{"sympa": |
48 |
misc |
560 |
webapp_file => "sympa/webapp_sympa.conf", |
49 |
misc |
551 |
} |
50 |
misc |
2605 |
|
51 |
misc |
562 |
apache::vhost_redirect_ssl { "$vhost": } |
52 |
misc |
2605 |
|
53 |
boklm |
1235 |
apache::vhost_base { "$vhost": |
54 |
misc |
2295 |
use_ssl => true, |
55 |
boklm |
1235 |
content => template("sympa/vhost_ml.conf"), |
56 |
misc |
551 |
} |
57 |
misc |
2605 |
|
58 |
misc |
551 |
subversion::snapshot { "/etc/sympa/web_tt2": |
59 |
|
|
source => "svn://svn.mageia.org/svn/web/templates/sympa/trunk" |
60 |
|
|
} |
61 |
misc |
553 |
|
62 |
misc |
576 |
file { ["/etc/sympa/lists_xml/", |
63 |
misc |
578 |
"/etc/sympa/scenari/", |
64 |
misc |
576 |
"/etc/sympa/data_sources/", |
65 |
|
|
"/etc/sympa/search_filters/"]: |
66 |
misc |
553 |
ensure => directory, |
67 |
misc |
635 |
purge => true, |
68 |
|
|
recurse => true, |
69 |
|
|
force => true, |
70 |
misc |
553 |
} |
71 |
misc |
569 |
|
72 |
misc |
2299 |
file { |
73 |
|
|
"/etc/sympa/scenari/subscribe.open_web_only_notify": |
74 |
|
|
source => "puppet:///modules/sympa/scenari/open_web_only_notify"; |
75 |
|
|
"/etc/sympa/scenari/unsubscribe.open_web_only_notify": |
76 |
|
|
source => "puppet:///modules/sympa/scenari/open_web_only_notify"; |
77 |
|
|
"/etc/sympa/scenari/send.subscriber_moderated": |
78 |
|
|
source => "puppet:///modules/sympa/scenari/subscriber_moderated"; |
79 |
|
|
"/etc/sympa/scenari/create_list.forbidden": |
80 |
|
|
source => "puppet:///modules/sympa/scenari/forbidden"; |
81 |
|
|
"/etc/sympa/topics.conf": |
82 |
|
|
source => "puppet:///modules/sympa/topics.conf"; |
83 |
misc |
588 |
} |
84 |
|
|
|
85 |
misc |
576 |
define ldap_search_filter { |
86 |
misc |
604 |
file { "/etc/sympa/search_filters/$name.ldap": |
87 |
misc |
2605 |
content => template('sympa/search_filters/group.ldap') |
88 |
misc |
576 |
} |
89 |
|
|
} |
90 |
|
|
|
91 |
misc |
574 |
define ldap_group_datasource { |
92 |
misc |
598 |
file { "/etc/sympa/data_sources/$name.incl": |
93 |
misc |
2605 |
content => template('sympa/data_sources/ldap_group.incl') |
94 |
misc |
574 |
} |
95 |
|
|
} |
96 |
misc |
581 |
|
97 |
|
|
define scenario_sender_ldap_group { |
98 |
misc |
606 |
file { "/etc/sympa/scenari/send.restricted_$name": |
99 |
misc |
2605 |
content => template('sympa/scenari/sender.ldap_group') |
100 |
misc |
589 |
} |
101 |
misc |
581 |
} |
102 |
|
|
|
103 |
|
|
define scenario_sender_email { |
104 |
misc |
758 |
$sender_email_file = regsubst($name,'\@','-at-') |
105 |
|
|
file { "/etc/sympa/scenari/send.restricted_$sender_email_file": |
106 |
misc |
2605 |
content => template('sympa/scenari/sender.email') |
107 |
misc |
589 |
} |
108 |
misc |
581 |
} |
109 |
|
|
|
110 |
misc |
2605 |
# add each group that could be used in a sympa ml either as |
111 |
misc |
574 |
# - owner |
112 |
|
|
# - editor ( moderation ) |
113 |
misc |
602 |
ldap_group_datasource { "mga-sysadmin": } |
114 |
misc |
574 |
ldap_group_datasource { "mga-ml_moderators": } |
115 |
|
|
|
116 |
misc |
576 |
|
117 |
misc |
569 |
# directory that will hold the list data |
118 |
|
|
# i am not sure of the name ( misc, 09/12/10 ) |
119 |
|
|
file { "/var/lib/sympa/expl/": |
120 |
|
|
ensure => directory, |
121 |
|
|
owner => sympa, |
122 |
|
|
} |
123 |
dmorgan |
234 |
} |
124 |
misc |
557 |
|
125 |
misc |
2605 |
define list($subject, |
126 |
|
|
$profile = false, |
127 |
misc |
580 |
$language = 'en', |
128 |
misc |
644 |
$topics = false, |
129 |
misc |
580 |
$reply_to = false, |
130 |
|
|
$sender_email = false, |
131 |
|
|
$sender_ldap_group = false, |
132 |
|
|
$subscriber_ldap_group = false, |
133 |
misc |
1344 |
$public_archive = true, |
134 |
misc |
2004 |
$subscription_open = false) { |
135 |
misc |
557 |
|
136 |
misc |
562 |
include sympa::variable |
137 |
misc |
1396 |
$ldap_password = extlookup("sympa_ldap",'x') |
138 |
boklm |
2019 |
$custom_subject = $name |
139 |
misc |
562 |
|
140 |
misc |
557 |
$xml_file = "/etc/sympa/lists_xml/$name.xml" |
141 |
|
|
|
142 |
misc |
607 |
if $sender_email { |
143 |
|
|
$sender_email_file = regsubst($sender_email,'\@','-at-') |
144 |
misc |
2605 |
} else { |
145 |
|
|
$sender_email_file = '' |
146 |
misc |
607 |
} |
147 |
|
|
|
148 |
misc |
557 |
file { "$xml_file": |
149 |
misc |
1971 |
content => template('sympa/list.xml'), |
150 |
misc |
1967 |
require => Package[sympa], |
151 |
misc |
557 |
} |
152 |
|
|
|
153 |
misc |
562 |
exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file": |
154 |
misc |
590 |
require => File["$xml_file"], |
155 |
misc |
592 |
creates => "/var/lib/sympa/expl/$name", |
156 |
misc |
580 |
before => File["/var/lib/sympa/expl/$name/config"], |
157 |
misc |
557 |
} |
158 |
misc |
580 |
|
159 |
|
|
file { "/var/lib/sympa/expl/$name/config": |
160 |
|
|
owner => sympa, |
161 |
|
|
group => sympa, |
162 |
|
|
mode => 750, |
163 |
misc |
2605 |
content => template("sympa/config"), |
164 |
misc |
645 |
notify => Service['sympa'], |
165 |
misc |
580 |
} |
166 |
misc |
581 |
|
167 |
|
|
if $sender_ldap_group { |
168 |
|
|
if ! defined(Sympa::Server::Scenario_sender_ldap_group[$sender_ldap_group]) { |
169 |
|
|
sympa::server::scenario_sender_ldap_group { $sender_ldap_group: } |
170 |
|
|
} |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
if $sender_email { |
174 |
misc |
758 |
if ! defined(Sympa::Server::Scenario_sender_email[$sender_email]) { |
175 |
|
|
sympa::server::scenario_sender_email { $sender_email: } |
176 |
misc |
581 |
} |
177 |
|
|
} |
178 |
misc |
2605 |
|
179 |
misc |
581 |
if $subscriber_ldap_group { |
180 |
|
|
if ! defined(Sympa::Server::Ldap_search_filter[$subscriber_ldap_group]) { |
181 |
|
|
sympa::server::ldap_search_filter { $subscriber_ldap_group: } |
182 |
|
|
} |
183 |
|
|
} |
184 |
misc |
557 |
} |
185 |
misc |
582 |
|
186 |
|
|
# |
187 |
|
|
# various types of list that can be directly used |
188 |
|
|
# |
189 |
|
|
# |
190 |
boklm |
2087 |
|
191 |
|
|
# public discussion list |
192 |
|
|
# reply_to is set to the list |
193 |
misc |
644 |
define public_list($subject, $language = 'en', $topics = false) { |
194 |
boklm |
2088 |
include sympa::variable |
195 |
misc |
582 |
list { $name: |
196 |
|
|
subject => $subject, |
197 |
|
|
# profile => "public", |
198 |
|
|
language => $language, |
199 |
misc |
675 |
topics => $topics, |
200 |
boklm |
2087 |
reply_to => "$name@$sympa::variable::vhost", |
201 |
misc |
582 |
} |
202 |
|
|
} |
203 |
|
|
|
204 |
|
|
# list where announce are sent by member of ldap_group |
205 |
|
|
# reply_to is set to $reply_to |
206 |
misc |
644 |
define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en', $topics = false) { |
207 |
misc |
582 |
# profile + scenario |
208 |
|
|
list{ $name: |
209 |
|
|
subject => $subject, |
210 |
|
|
profile => "", |
211 |
|
|
language => $language, |
212 |
misc |
675 |
topics => $topics, |
213 |
misc |
582 |
reply_to => $reply_to, |
214 |
|
|
sender_ldap_group => $sender_ldap_group, |
215 |
|
|
} |
216 |
|
|
} |
217 |
|
|
|
218 |
|
|
|
219 |
misc |
2605 |
# list where announce are sent by $email only |
220 |
|
|
# reply_to is set to $reply_to |
221 |
misc |
644 |
define announce_list_email($subject, $reply_to, $sender_email, $language = 'en', $topics = false) { |
222 |
misc |
582 |
list{ $name: |
223 |
|
|
subject => $subject, |
224 |
|
|
profile => "", |
225 |
|
|
language => $language, |
226 |
misc |
675 |
topics => $topics, |
227 |
misc |
582 |
reply_to => $reply_to, |
228 |
|
|
sender_email => $sender_email, |
229 |
|
|
} |
230 |
|
|
} |
231 |
|
|
|
232 |
|
|
# list where people cannot subscribe, where people from $ldap_group receive |
233 |
|
|
# mail, with public archive |
234 |
misc |
644 |
define restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
235 |
misc |
582 |
list{ $name: |
236 |
|
|
subject => $subject, |
237 |
|
|
profile => "", |
238 |
misc |
675 |
topics => $topics, |
239 |
misc |
582 |
language => $language, |
240 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
241 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
242 |
|
|
} |
243 |
|
|
} |
244 |
|
|
|
245 |
misc |
1345 |
# list where only people from the ldap_group can post, ad where they are subscribe |
246 |
|
|
# by default, but anybody else can subscribe to read and receive messages |
247 |
|
|
define public_restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
248 |
|
|
list{ $name: |
249 |
|
|
subject => $subject, |
250 |
|
|
profile => "", |
251 |
|
|
topics => $topics, |
252 |
|
|
language => $language, |
253 |
|
|
subscriber_ldap_group => $subscriber_ldap_group, |
254 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
255 |
|
|
subscription_open => true, |
256 |
|
|
} |
257 |
|
|
} |
258 |
|
|
|
259 |
|
|
|
260 |
misc |
582 |
# same as restricted list, but anybody can post |
261 |
misc |
644 |
define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en', $topics = false) { |
262 |
misc |
582 |
list{ $name: |
263 |
|
|
subject => $subject, |
264 |
|
|
profile => "", |
265 |
|
|
language => $language, |
266 |
misc |
675 |
topics => $topics, |
267 |
misc |
582 |
subscriber_ldap_group => $subscriber_ldap_group, |
268 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
269 |
misc |
2605 |
} |
270 |
misc |
582 |
} |
271 |
|
|
|
272 |
|
|
# list with private archive, restricted to member of $ldap_group |
273 |
misc |
644 |
define private_list($subject, $subscriber_ldap_group, $language ='en', $topics = false) { |
274 |
misc |
582 |
list{ $name: |
275 |
|
|
subject => $subject, |
276 |
|
|
profile => "", |
277 |
|
|
language => $language, |
278 |
misc |
675 |
topics => $topics, |
279 |
misc |
582 |
subscriber_ldap_group => $subscriber_ldap_group, |
280 |
|
|
sender_ldap_group => $subscriber_ldap_group, |
281 |
|
|
public_archive => false, |
282 |
|
|
} |
283 |
|
|
} |
284 |
|
|
|
285 |
dmorgan |
234 |
} |
286 |
|
|
|