/[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 645 - (show annotations) (download)
Fri Dec 17 00:50:58 2010 UTC (13 years, 4 months ago) by misc
File size: 10597 byte(s)
restart sympa when a list configuration is changed
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 }
243 }
244
245 # list where announce are sent by member of ldap_group
246 # reply_to is set to $reply_to
247 define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en', $topics = false) {
248 # profile + scenario
249 list{ $name:
250 subject => $subject,
251 profile => "",
252 language => $language,
253 reply_to => $reply_to,
254 sender_ldap_group => $sender_ldap_group,
255 }
256 }
257
258
259 # list where announce are sent by $email only
260 # reply_to is set to $reply_to
261 define announce_list_email($subject, $reply_to, $sender_email, $language = 'en', $topics = false) {
262 list{ $name:
263 subject => $subject,
264 profile => "",
265 language => $language,
266 reply_to => $reply_to,
267 sender_email => $sender_email,
268 }
269 }
270
271 # list where people cannot subscribe, where people from $ldap_group receive
272 # mail, with public archive
273 define restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) {
274 list{ $name:
275 subject => $subject,
276 profile => "",
277 language => $language,
278 subscriber_ldap_group => $subscriber_ldap_group,
279 sender_ldap_group => $subscriber_ldap_group,
280 }
281 }
282
283 # same as restricted list, but anybody can post
284 define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en', $topics = false) {
285 list{ $name:
286 subject => $subject,
287 profile => "",
288 language => $language,
289 subscriber_ldap_group => $subscriber_ldap_group,
290 sender_ldap_group => $subscriber_ldap_group,
291 }
292 }
293
294 # list with private archive, restricted to member of $ldap_group
295 define private_list($subject, $subscriber_ldap_group, $language ='en', $topics = false) {
296 list{ $name:
297 subject => $subject,
298 profile => "",
299 language => $language,
300 subscriber_ldap_group => $subscriber_ldap_group,
301 sender_ldap_group => $subscriber_ldap_group,
302 public_archive => false,
303 }
304 }
305
306 # list with private archive, restricted to member of $ldap_group
307 # everybody can post
308 # used for contact alias
309 define private_list_open($subject, $subscriber_ldap_group, $language ='en', $topics = false) {
310 list{ $name:
311 subject => $subject,
312 profile => "",
313 language => $language,
314 subscriber_ldap_group => $subscriber_ldap_group,
315 public_archive => false,
316 }
317 }
318
319 # same as private_list, but post are restricted to $email
320 # ( scripting )
321 define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en', $topics = false) {
322 list{ $name:
323 subject => $subject,
324 profile => "",
325 language => $language,
326 subscriber_ldap_group => $subscriber_ldap_group,
327 sender_email => $sender_email,
328 public_archive => false,
329 }
330 }
331 }
332

  ViewVC Help
Powered by ViewVC 1.1.30