/[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 587 - (show annotations) (download)
Mon Dec 13 23:55:07 2010 UTC (13 years, 3 months ago) by misc
File size: 8781 byte(s)
- move file to subdirectory, easier to understand what's going on
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 define ldap_search_filter {
89 file { "/etc/sympa/search_filters/ldap-$name.ldap":
90 ensure => present,
91 owner => root,
92 group => root,
93 mode => 755,
94 content => template('sympa/search_filters/group.ldap')
95 }
96 }
97
98 define ldap_group_datasource {
99 file { "/etc/sympa/data_sources/ldap-$name.incl":
100 ensure => present,
101 owner => root,
102 group => root,
103 mode => 755,
104 content => template('sympa/data_sources/ldap_group.incl')
105 }
106 }
107
108 define scenario_sender_ldap_group {
109 # TODO
110
111 }
112
113 define scenario_sender_email {
114 # TODO
115 }
116
117 # add each group that could be used in a sympa ml either as
118 # - owner
119 # - editor ( moderation )
120 ldap_group_datasource { "mga-sysadm": }
121 ldap_group_datasource { "mga-ml_moderators": }
122
123
124 # directory that will hold the list data
125 # i am not sure of the name ( misc, 09/12/10 )
126 file { "/var/lib/sympa/expl/":
127 ensure => directory,
128 owner => sympa,
129 group => root,
130 mode => 755,
131 }
132 }
133
134 define list($subject,
135 $profile = false,
136 $language = 'en',
137 $reply_to = false,
138 $sender_email = false,
139 $sender_ldap_group = false,
140 $subscriber_ldap_group = false,
141 $public_archive = true ) {
142
143 include sympa::variable
144
145 $xml_file = "/etc/sympa/lists_xml/$name.xml"
146
147 file { "$xml_file":
148 owner => root,
149 group => root,
150 content => template('sympa/list.xml')
151 }
152
153 exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file":
154 refreshonly => true,
155 subscribe => File["$xml_file"],
156 before => File["/var/lib/sympa/expl/$name/config"],
157 }
158
159 file { "/var/lib/sympa/expl/$name/config":
160 ensure => present,
161 owner => sympa,
162 group => sympa,
163 mode => 750,
164 content => template("sympa/config"),
165 }
166
167 if $sender_ldap_group {
168 if ! defined(Sympa::Server::Scenario_sender_ldap_group[$sender_ldap_group]) {
169 sympa::server::scenario_sender_ldap_group { $sender_ldap_group: }
170 }
171 }
172
173 if $sender_email {
174 if ! defined(Sympa::Server::Scenario_sender_email[$sender_email]) {
175 sympa::server::scenario_sender_email { $sender_email: }
176 }
177 }
178
179 if $subscriber_ldap_group {
180 if ! defined(Sympa::Server::Ldap_search_filter[$subscriber_ldap_group]) {
181 sympa::server::ldap_search_filter { $subscriber_ldap_group: }
182 }
183 }
184 }
185
186 #
187 # various types of list that can be directly used
188 #
189 #
190 define public_list($subject, $language = 'en') {
191 list { $name:
192 subject => $subject,
193 # profile => "public",
194 language => $language,
195 }
196 }
197
198 # list where announce are sent by member of ldap_group
199 # reply_to is set to $reply_to
200 define announce_list_group($subject, $reply_to, $sender_ldap_group, $language = 'en') {
201 # profile + scenario
202 list{ $name:
203 subject => $subject,
204 profile => "",
205 language => $language,
206 reply_to => $reply_to,
207 sender_ldap_group => $sender_ldap_group,
208 }
209
210 }
211
212
213 # list where announce are sent by $email only
214 # reply_to is set to $reply_to
215 define announce_list_email($subject, $reply_to, $sender_email, $language = 'en') {
216 list{ $name:
217 subject => $subject,
218 profile => "",
219 language => $language,
220 reply_to => $reply_to,
221 sender_email => $sender_email,
222 }
223 }
224
225 # list where people cannot subscribe, where people from $ldap_group receive
226 # mail, with public archive
227 define restricted_list($subject, $subscriber_ldap_group, $language = 'en') {
228 list{ $name:
229 subject => $subject,
230 profile => "",
231 language => $language,
232 subscriber_ldap_group => $subscriber_ldap_group,
233 sender_ldap_group => $subscriber_ldap_group,
234 }
235 }
236
237 # same as restricted list, but anybody can post
238 define restricted_list_open($subject, $subscriber_ldap_group, $language = 'en') {
239 list{ $name:
240 subject => $subject,
241 profile => "",
242 language => $language,
243 subscriber_ldap_group => $subscriber_ldap_group,
244 sender_ldap_group => $subscriber_ldap_group,
245 }
246 }
247
248 # list with private archive, restricted to member of $ldap_group
249 define private_list($subject, $subscriber_ldap_group, $language ='en') {
250 list{ $name:
251 subject => $subject,
252 profile => "",
253 language => $language,
254 subscriber_ldap_group => $subscriber_ldap_group,
255 sender_ldap_group => $subscriber_ldap_group,
256 public_archive => false,
257 }
258 }
259
260 # list with private archive, restricted to member of $ldap_group
261 # everybody can post
262 # used for contact alias
263 define private_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 public_archive => false,
270 }
271 }
272
273 # same as private_list, but post are restricted to $email
274 # ( scripting )
275 define private_list_email($subject, $subscriber_ldap_group, $sender_email, $language ='en') {
276 list{ $name:
277 subject => $subject,
278 profile => "",
279 language => $language,
280 subscriber_ldap_group => $subscriber_ldap_group,
281 sender_email => $sender_email,
282 public_archive => false,
283 }
284 }
285
286 }
287

  ViewVC Help
Powered by ViewVC 1.1.30