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 |
} |
49 |
|
50 |
|
51 |
include apache::mod_fcgid |
52 |
apache::webapp_other{"sympa": |
53 |
webapp_file => "sympa/webapp_sympa.conf", |
54 |
} |
55 |
|
56 |
apache::vhost_redirect_ssl { "$vhost": } |
57 |
|
58 |
apache::vhost_other_app { "$vhost": |
59 |
vhost_file => "sympa/vhost_ml.conf", |
60 |
} |
61 |
|
62 |
openssl::self_signed_cert{ "$vhost": |
63 |
directory => "/etc/ssl/apache/" |
64 |
} |
65 |
|
66 |
|
67 |
@@postgresql::database { 'sympa': |
68 |
description => "Sympa database", |
69 |
user => "sympa", |
70 |
require => Postgresql::User["sympa"] |
71 |
} |
72 |
|
73 |
subversion::snapshot { "/etc/sympa/web_tt2": |
74 |
source => "svn://svn.mageia.org/svn/web/templates/sympa/trunk" |
75 |
} |
76 |
|
77 |
file { "/etc/sympa/lists_xml/": |
78 |
ensure => directory, |
79 |
owner => root, |
80 |
group => root, |
81 |
mode => 755, |
82 |
} |
83 |
|
84 |
# directory that will hold the list data |
85 |
# i am not sure of the name ( misc, 09/12/10 ) |
86 |
file { "/var/lib/sympa/expl/": |
87 |
ensure => directory, |
88 |
owner => sympa, |
89 |
group => root, |
90 |
mode => 755, |
91 |
} |
92 |
} |
93 |
|
94 |
define list($subject, $profile, $language = 'en') { |
95 |
|
96 |
include sympa::variable |
97 |
|
98 |
$xml_file = "/etc/sympa/lists_xml/$name.xml" |
99 |
|
100 |
file { "$xml_file": |
101 |
owner => root, |
102 |
group => root, |
103 |
content => template('sympa/list.xml') |
104 |
} |
105 |
|
106 |
exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file": |
107 |
refreshonly => true, |
108 |
subscribe => File["$xml_file"] |
109 |
} |
110 |
} |
111 |
} |
112 |
|