/[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 1281 - (show annotations) (download)
Tue Mar 8 11:54:36 2011 UTC (13 years, 1 month ago) by misc
File size: 11039 byte(s)
- use the new type for remote database declaration
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_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_base { "$vhost":
60 use_ssl => true,
61 content => template("sympa/vhost_ml.conf"),
62 }
63
64 postgresql::remote_database { 'sympa':
65 description => "Sympa database",
66 user => "sympa",
67 }
68
69 subversion::snapshot { "/etc/sympa/web_tt2":
70 source => "svn://svn.mageia.org/svn/web/templates/sympa/trunk"
71 }
72
73 file { ["/etc/sympa/lists_xml/",
74 "/etc/sympa/scenari/",
75 "/etc/sympa/data_sources/",
76 "/etc/sympa/search_filters/"]:
77 ensure => directory,
78 owner => root,
79 group => root,
80 mode => 755,
81 purge => true,
82 recurse => true,
83 force => true,
84 }
85
86 file { ["/etc/sympa/scenari/subscribe.open_web_only_notify",
87 "/etc/sympa/scenari/unsubscribe.open_web_only_notify"]:
88 ensure => present,
89 owner => root,
90 group => root,
91 mode => 755,
92 source => "puppet:///modules/sympa/scenari/open_web_only_notify",
93 }
94
95 file { ["/etc/sympa/scenari/send.subscriber_moderated"]:
96 ensure => present,
97 owner => root,
98 group => root,
99 mode => 755,
100 source => "puppet:///modules/sympa/scenari/subscriber_moderated",
101 }
102
103 file { ["/etc/sympa/scenari/create_list.forbidden"]:
104 ensure => present,
105 owner => root,
106 group => root,
107 mode => 755,
108 source => "puppet:///modules/sympa/scenari/forbidden",
109 }
110
111
112 file { ["/etc/sympa/topics.conf"]:
113 ensure => present,
114 owner => root,
115 group => root,
116 mode => 755,
117 source => "puppet:///modules/sympa/topics.conf",
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 }
176 }
177
178 define list($subject,
179 $profile = false,
180 $language = 'en',
181 $topics = false,
182 $reply_to = false,
183 $sender_email = false,
184 $sender_ldap_group = false,
185 $subscriber_ldap_group = false,
186 $public_archive = true ) {
187
188 include sympa::variable
189
190 $xml_file = "/etc/sympa/lists_xml/$name.xml"
191
192 if $sender_email {
193 $sender_email_file = regsubst($sender_email,'\@','-at-')
194 } else {
195 $sender_email_file = ''
196 }
197
198 file { "$xml_file":
199 owner => root,
200 group => root,
201 content => template('sympa/list.xml')
202 }
203
204 exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file":
205 require => File["$xml_file"],
206 creates => "/var/lib/sympa/expl/$name",
207 before => File["/var/lib/sympa/expl/$name/config"],
208 }
209
210 file { "/var/lib/sympa/expl/$name/config":
211 ensure => present,
212 owner => sympa,
213 group => sympa,
214 mode => 750,
215 content => template("sympa/config"),
216 notify => Service['sympa'],
217 }
218
219 if $sender_ldap_group {
220 if ! defined(Sympa::Server::Scenario_sender_ldap_group[$sender_ldap_group]) {
221 sympa::server::scenario_sender_ldap_group { $sender_ldap_group: }
222 }
223 }
224
225 if $sender_email {
226 if ! defined(Sympa::Server::Scenario_sender_email[$sender_email]) {
227 sympa::server::scenario_sender_email { $sender_email: }
228 }
229 }
230
231 if $subscriber_ldap_group {
232 if ! defined(Sympa::Server::Ldap_search_filter[$subscriber_ldap_group]) {
233 sympa::server::ldap_search_filter { $subscriber_ldap_group: }
234 }
235 }
236 }
237
238 #
239 # various types of list that can be directly used
240 #
241 #
242 define public_list($subject, $language = 'en', $topics = false) {
243 list { $name:
244 subject => $subject,
245 # profile => "public",
246 language => $language,
247 topics => $topics,
248 }
249 }
250
251 # list where announce are sent by member of ldap_group
252 # reply_to is set to $reply_to
253 define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en', $topics = false) {
254 # profile + scenario
255 list{ $name:
256 subject => $subject,
257 profile => "",
258 language => $language,
259 topics => $topics,
260 reply_to => $reply_to,
261 sender_ldap_group => $sender_ldap_group,
262 }
263 }
264
265
266 # list where announce are sent by $email only
267 # reply_to is set to $reply_to
268 define announce_list_email($subject, $reply_to, $sender_email, $language = 'en', $topics = false) {
269 list{ $name:
270 subject => $subject,
271 profile => "",
272 language => $language,
273 topics => $topics,
274 reply_to => $reply_to,
275 sender_email => $sender_email,
276 }
277 }
278
279 # list where people cannot subscribe, where people from $ldap_group receive
280 # mail, with public archive
281 define restricted_list($subject, $subscriber_ldap_group, $language = 'en', $topics = false) {
282 list{ $name:
283 subject => $subject,
284 profile => "",
285 topics => $topics,
286 language => $language,
287 subscriber_ldap_group => $subscriber_ldap_group,
288 sender_ldap_group => $subscriber_ldap_group,
289 }
290 }
291
292 # same as restricted list, but anybody can post
293 define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en', $topics = false) {
294 list{ $name:
295 subject => $subject,
296 profile => "",
297 language => $language,
298 topics => $topics,
299 subscriber_ldap_group => $subscriber_ldap_group,
300 sender_ldap_group => $subscriber_ldap_group,
301 }
302 }
303
304 # list with private archive, restricted to member of $ldap_group
305 define private_list($subject, $subscriber_ldap_group, $language ='en', $topics = false) {
306 list{ $name:
307 subject => $subject,
308 profile => "",
309 language => $language,
310 topics => $topics,
311 subscriber_ldap_group => $subscriber_ldap_group,
312 sender_ldap_group => $subscriber_ldap_group,
313 public_archive => false,
314 }
315 }
316
317 # list with private archive, restricted to member of $ldap_group
318 # everybody can post
319 # used for contact alias
320 define private_list_open($subject, $subscriber_ldap_group, $language ='en', $topics = false) {
321 list{ $name:
322 subject => $subject,
323 profile => "",
324 language => $language,
325 topics => $topics,
326 subscriber_ldap_group => $subscriber_ldap_group,
327 public_archive => false,
328 }
329 }
330
331 # same as private_list, but post are restricted to $email
332 # ( scripting )
333 define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en', $topics = false) {
334 list{ $name:
335 subject => $subject,
336 profile => "",
337 language => $language,
338 topics => $topics,
339 subscriber_ldap_group => $subscriber_ldap_group,
340 sender_email => $sender_email,
341 public_archive => false,
342 }
343 }
344 }
345

  ViewVC Help
Powered by ViewVC 1.1.30