/[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 607 - (show annotations) (download)
Tue Dec 14 18:29:44 2010 UTC (13 years, 4 months ago) by misc
File size: 9805 byte(s)
do not use @ in filename, this confuse sympa ( and so, replace it by
-at- )
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 $password = extlookup("sympa_password",'x')
26 $ldap_passwd = extlookup("sympa_ldap",'x')
27
28 @@postgresql::user { 'sympa':
29 password => $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 }
87
88 file { ["/etc/sympa/scenari/subscribe.open_web_only_notify",
89 "/etc/sympa/scenari/unsubscribe.open_web_only_notify"]:
90 ensure => present,
91 owner => root,
92 group => root,
93 mode => 755,
94 source => "puppet:///modules/sympa/scenari/open_web_only_notify",
95 }
96
97 define ldap_search_filter {
98 file { "/etc/sympa/search_filters/$name.ldap":
99 ensure => present,
100 owner => root,
101 group => root,
102 mode => 755,
103 content => template('sympa/search_filters/group.ldap')
104 }
105 }
106
107 define ldap_group_datasource {
108 file { "/etc/sympa/data_sources/$name.incl":
109 ensure => present,
110 owner => root,
111 group => root,
112 mode => 755,
113 content => template('sympa/data_sources/ldap_group.incl')
114 }
115 }
116
117 define scenario_sender_ldap_group {
118 file { "/etc/sympa/scenari/send.restricted_$name":
119 ensure => present,
120 owner => root,
121 group => root,
122 mode => 755,
123 content => template('sympa/scenari/sender.ldap_group')
124 }
125 }
126
127 define scenario_sender_email {
128 file { "/etc/sympa/scenari/send.restricted_$name":
129 ensure => present,
130 owner => root,
131 group => root,
132 mode => 755,
133 content => template('sympa/scenari/sender.email')
134 }
135 }
136
137 # add each group that could be used in a sympa ml either as
138 # - owner
139 # - editor ( moderation )
140 ldap_group_datasource { "mga-sysadmin": }
141 ldap_group_datasource { "mga-ml_moderators": }
142
143
144 # directory that will hold the list data
145 # i am not sure of the name ( misc, 09/12/10 )
146 file { "/var/lib/sympa/expl/":
147 ensure => directory,
148 owner => sympa,
149 group => root,
150 mode => 755,
151 }
152 }
153
154 define list($subject,
155 $profile = false,
156 $language = 'en',
157 $reply_to = false,
158 $sender_email = false,
159 $sender_ldap_group = false,
160 $subscriber_ldap_group = false,
161 $public_archive = true ) {
162
163 include sympa::variable
164
165 $xml_file = "/etc/sympa/lists_xml/$name.xml"
166
167 if $sender_email {
168 $sender_email_file = regsubst($sender_email,'\@','-at-')
169 } else {
170 $sender_email_file = ''
171 }
172
173 file { "$xml_file":
174 owner => root,
175 group => root,
176 content => template('sympa/list.xml')
177 }
178
179 exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file":
180 require => File["$xml_file"],
181 creates => "/var/lib/sympa/expl/$name",
182 before => File["/var/lib/sympa/expl/$name/config"],
183 }
184
185 file { "/var/lib/sympa/expl/$name/config":
186 ensure => present,
187 owner => sympa,
188 group => sympa,
189 mode => 750,
190 content => template("sympa/config"),
191 }
192
193 if $sender_ldap_group {
194 if ! defined(Sympa::Server::Scenario_sender_ldap_group[$sender_ldap_group]) {
195 sympa::server::scenario_sender_ldap_group { $sender_ldap_group: }
196 }
197 }
198
199 if $sender_email {
200 if ! defined(Sympa::Server::Scenario_sender_email[$sender_email_file]) {
201 sympa::server::scenario_sender_email { $sender_email_file: }
202 }
203 }
204
205 if $subscriber_ldap_group {
206 if ! defined(Sympa::Server::Ldap_search_filter[$subscriber_ldap_group]) {
207 sympa::server::ldap_search_filter { $subscriber_ldap_group: }
208 }
209 }
210 }
211
212 #
213 # various types of list that can be directly used
214 #
215 #
216 define public_list($subject, $language = 'en') {
217 list { $name:
218 subject => $subject,
219 # profile => "public",
220 language => $language,
221 }
222 }
223
224 # list where announce are sent by member of ldap_group
225 # reply_to is set to $reply_to
226 define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en') {
227 # profile + scenario
228 list{ $name:
229 subject => $subject,
230 profile => "",
231 language => $language,
232 reply_to => $reply_to,
233 sender_ldap_group => $sender_ldap_group,
234 }
235 }
236
237
238 # list where announce are sent by $email only
239 # reply_to is set to $reply_to
240 define announce_list_email($subject, $reply_to, $sender_email, $language = 'en') {
241 list{ $name:
242 subject => $subject,
243 profile => "",
244 language => $language,
245 reply_to => $reply_to,
246 sender_email => $sender_email,
247 }
248 }
249
250 # list where people cannot subscribe, where people from $ldap_group receive
251 # mail, with public archive
252 define restricted_list($subject, $subscriber_ldap_group, $language = 'en') {
253 list{ $name:
254 subject => $subject,
255 profile => "",
256 language => $language,
257 subscriber_ldap_group => $subscriber_ldap_group,
258 sender_ldap_group => $subscriber_ldap_group,
259 }
260 }
261
262 # same as restricted list, but anybody can post
263 define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en') {
264 list{ $name:
265 subject => $subject,
266 profile => "",
267 language => $language,
268 subscriber_ldap_group => $subscriber_ldap_group,
269 sender_ldap_group => $subscriber_ldap_group,
270 }
271 }
272
273 # list with private archive, restricted to member of $ldap_group
274 define private_list($subject, $subscriber_ldap_group, $language ='en') {
275 list{ $name:
276 subject => $subject,
277 profile => "",
278 language => $language,
279 subscriber_ldap_group => $subscriber_ldap_group,
280 sender_ldap_group => $subscriber_ldap_group,
281 public_archive => false,
282 }
283 }
284
285 # list with private archive, restricted to member of $ldap_group
286 # everybody can post
287 # used for contact alias
288 define private_list_open($subject, $subscriber_ldap_group, $language ='en') {
289 list{ $name:
290 subject => $subject,
291 profile => "",
292 language => $language,
293 subscriber_ldap_group => $subscriber_ldap_group,
294 public_archive => false,
295 }
296 }
297
298 # same as private_list, but post are restricted to $email
299 # ( scripting )
300 define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en') {
301 list{ $name:
302 subject => $subject,
303 profile => "",
304 language => $language,
305 subscriber_ldap_group => $subscriber_ldap_group,
306 sender_email => $sender_email,
307 public_archive => false,
308 }
309 }
310 }
311

  ViewVC Help
Powered by ViewVC 1.1.30