/[adm]/puppet/modules/sympa/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/sympa/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2003 - (show annotations) (download)
Mon Sep 12 21:38:16 2011 UTC (12 years, 7 months ago) by misc
File size: 11884 byte(s)
add header to the mail on the sympa, popular request asked on
sysadmin. Disable previous commit since the xml file is used only when the
ml is created ( and not used after anymore )
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
191 include sympa::variable
192 $ldap_password = extlookup("sympa_ldap",'x')
193
194 $xml_file = "/etc/sympa/lists_xml/$name.xml"
195
196 if $sender_email {
197 $sender_email_file = regsubst($sender_email,'\@','-at-')
198 } else {
199 $sender_email_file = ''
200 }
201
202 file { "$xml_file":
203 owner => root,
204 group => root,
205 content => template('sympa/list.xml'),
206 require => Package[sympa],
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 # list where only people from the ldap_group can post, ad where they are subscribe
298 # by default, but anybody else can subscribe to read and receive messages
299 define public_restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) {
300 list{ $name:
301 subject => $subject,
302 profile => "",
303 topics => $topics,
304 language => $language,
305 subscriber_ldap_group => $subscriber_ldap_group,
306 sender_ldap_group => $subscriber_ldap_group,
307 subscription_open => true,
308 }
309 }
310
311
312 # same as restricted list, but anybody can post
313 define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en', $topics = false) {
314 list{ $name:
315 subject => $subject,
316 profile => "",
317 language => $language,
318 topics => $topics,
319 subscriber_ldap_group => $subscriber_ldap_group,
320 sender_ldap_group => $subscriber_ldap_group,
321 }
322 }
323
324 # list with private archive, restricted to member of $ldap_group
325 define private_list($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 sender_ldap_group => $subscriber_ldap_group,
333 public_archive => false,
334 }
335 }
336
337 # list with private archive, restricted to member of $ldap_group
338 # everybody can post
339 # used for contact alias
340 define private_list_open($subject, $subscriber_ldap_group, $language ='en', $topics = false) {
341 list{ $name:
342 subject => $subject,
343 profile => "",
344 language => $language,
345 topics => $topics,
346 subscriber_ldap_group => $subscriber_ldap_group,
347 public_archive => false,
348 }
349 }
350
351 # same as private_list, but post are restricted to $email
352 # ( scripting )
353 define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en', $topics = false) {
354 list{ $name:
355 subject => $subject,
356 profile => "",
357 language => $language,
358 topics => $topics,
359 subscriber_ldap_group => $subscriber_ldap_group,
360 sender_email => $sender_email,
361 public_archive => false,
362 }
363 }
364 }
365

  ViewVC Help
Powered by ViewVC 1.1.30