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

  ViewVC Help
Powered by ViewVC 1.1.30