1 |
misc |
1053 |
class phpbb { |
2 |
misc |
1147 |
class base { |
3 |
|
|
$db = "phpbb" |
4 |
|
|
$user = "phpbb" |
5 |
misc |
1053 |
|
6 |
misc |
1147 |
include apache::mod_php |
7 |
misc |
1053 |
|
8 |
misc |
1176 |
package { ["php-gd", |
9 |
|
|
"php-xml", |
10 |
|
|
"php-zlib", |
11 |
|
|
"php-ftp", |
12 |
|
|
"php-magickwand", |
13 |
|
|
"php-pgsql", |
14 |
|
|
"php-ldap", ] : |
15 |
misc |
1147 |
ensure => installed |
16 |
|
|
} |
17 |
misc |
1053 |
|
18 |
misc |
1147 |
package { "perl-DBD-Pg": |
19 |
|
|
ensure => installed |
20 |
|
|
} |
21 |
misc |
1053 |
|
22 |
misc |
1147 |
file { "/usr/local/bin/phpbb_apply_config.pl": |
23 |
|
|
ensure => present, |
24 |
|
|
owner => root, |
25 |
|
|
group => root, |
26 |
|
|
mode => 755, |
27 |
|
|
source => 'puppet:///modules/phpbb/phpbb_apply_config.pl', |
28 |
|
|
} |
29 |
misc |
1053 |
|
30 |
misc |
1147 |
$pgsql_password = extlookup("phpbb_pgsql",'x') |
31 |
misc |
1281 |
postgresql::remote_user { $user: |
32 |
misc |
1147 |
password => $pgsql_password, |
33 |
|
|
} |
34 |
misc |
1053 |
|
35 |
misc |
1147 |
$forums_dir = "/var/www/forums/" |
36 |
|
|
file { "$forums_dir": |
37 |
|
|
ensure => directory, |
38 |
|
|
owner => root, |
39 |
|
|
group => root, |
40 |
|
|
} |
41 |
misc |
1158 |
# TODO add a ssl counterpart |
42 |
|
|
# TODO check that everything is locked down |
43 |
misc |
1156 |
apache::vhost_base { "forums.$domain": |
44 |
|
|
content => template("phpbb/forums_vhost.conf"), |
45 |
|
|
} |
46 |
|
|
|
47 |
misc |
1170 |
apache::vhost_base { "ssl_forums.$domain": |
48 |
|
|
use_ssl => true, |
49 |
|
|
vhost => "forums.$domain", |
50 |
|
|
content => template("phpbb/forums_vhost.conf"), |
51 |
|
|
} |
52 |
|
|
|
53 |
misc |
1530 |
file { "/etc/httpd/conf/vhosts.d/forums.d/": |
54 |
|
|
ensure => directory, |
55 |
|
|
} |
56 |
|
|
|
57 |
misc |
1075 |
} |
58 |
|
|
|
59 |
misc |
1528 |
define phpbb_config($key, $value) { |
60 |
misc |
1529 |
exec { "phpbb_apply $name": |
61 |
|
|
command => "/usr/local/bin/phpbb_apply_config.pl $key", |
62 |
misc |
1152 |
user => root, |
63 |
|
|
environment => ["PGDATABASE=$phpbb::base::database", |
64 |
|
|
"PGUSER=$phpbb::base::user", |
65 |
|
|
"PGPASSWORD=$phpbb::base::pgsql_password", |
66 |
|
|
"PGHOST=pgsql.$domain", |
67 |
|
|
"VALUE=$value"], |
68 |
|
|
require => File["/usr/local/bin/phpbb_apply_config.pl"], |
69 |
|
|
} |
70 |
|
|
} |
71 |
misc |
1151 |
|
72 |
misc |
1531 |
define redirection_instance($url) { |
73 |
|
|
$lang = $name |
74 |
|
|
file { "/etc/httpd/conf/vhosts.d/forums.d/redirect_$name.conf": |
75 |
|
|
ensure => present, |
76 |
|
|
owner => root, |
77 |
|
|
group => root, |
78 |
|
|
mode => 644, |
79 |
|
|
content => template("phpbb/forums_redirect.conf"), |
80 |
misc |
1532 |
notify => Service['apache'], |
81 |
misc |
1531 |
} |
82 |
|
|
} |
83 |
|
|
|
84 |
misc |
1151 |
# TODO find a way to avoid all the phpbb::base prefix |
85 |
|
|
define instance() { |
86 |
misc |
1161 |
include phpbb::base |
87 |
|
|
|
88 |
misc |
1148 |
$lang = $name |
89 |
misc |
1151 |
$database = "${phpbb::base::db}_$lang" |
90 |
|
|
|
91 |
misc |
1153 |
$user = $phpbb::base::user |
92 |
|
|
$pgsql_password = $phpbb::base::pgsql_password |
93 |
|
|
$forums_dir = $phpbb::base::forums_dir |
94 |
misc |
1075 |
|
95 |
misc |
1161 |
include git::client |
96 |
misc |
1167 |
exec { "git_clone $lang": |
97 |
|
|
command =>"git clone git://git.$domain/forum/ $lang", |
98 |
misc |
1147 |
cwd => $forums_dir, |
99 |
misc |
1154 |
creates => "$forums_dir/$lang", |
100 |
misc |
1169 |
require => File["$forums_dir"], |
101 |
misc |
1173 |
notify => Exec["rm_install $lang"], |
102 |
misc |
1147 |
} |
103 |
misc |
1075 |
|
104 |
misc |
1169 |
# remove this or the forum will not work ( 'board disabled' ) |
105 |
|
|
# maybe it would be better to move this elsehwere, I |
106 |
|
|
# am not sure ( and in any case, that's still in git ) |
107 |
|
|
exec { "rm_install $lang": |
108 |
misc |
1172 |
command => "rm -Rf $forums_dir/$lang/phpBB/install", |
109 |
misc |
1169 |
onlyif => "test -d $forums_dir/$lang/phpBB/install", |
110 |
|
|
} |
111 |
|
|
|
112 |
misc |
1181 |
# list found by reading ./install/install_install.php |
113 |
|
|
# end of check_server_requirements ( 2 loops ) |
114 |
misc |
1526 |
|
115 |
|
|
$writable_dirs = ['cache', |
116 |
|
|
'images/avatars/upload', |
117 |
|
|
'files', |
118 |
|
|
'store' ] |
119 |
|
|
|
120 |
|
|
$dir_names = regsubst($writable_dirs,'^',"$forums_dir/$lang/phpBB/") |
121 |
|
|
|
122 |
|
|
file { $dir_names: |
123 |
|
|
ensure => directory, |
124 |
|
|
owner => apache, |
125 |
|
|
group => root, |
126 |
|
|
mode => 755, |
127 |
|
|
require => Exec["git_clone $lang"], |
128 |
misc |
1168 |
} |
129 |
|
|
|
130 |
misc |
1147 |
file { "$forums_dir/$lang/phpBB/config.php": |
131 |
|
|
ensure => present, |
132 |
|
|
owner => root, |
133 |
|
|
group => root, |
134 |
|
|
mode => 644, |
135 |
|
|
content => template("phpbb/config.php"), |
136 |
|
|
} |
137 |
misc |
1075 |
|
138 |
|
|
|
139 |
misc |
1281 |
postgresql::remote_database { $database: |
140 |
misc |
1147 |
description => "Phpbb database", |
141 |
|
|
user => $user, |
142 |
|
|
} |
143 |
misc |
1053 |
|
144 |
misc |
1528 |
phpbb_config { "ldap_user/$lang": |
145 |
|
|
key => "ldap_user", |
146 |
misc |
1293 |
value => "cn=phpbb-$hostname,ou=System Accounts,$dc_suffix", |
147 |
misc |
1147 |
} |
148 |
|
|
|
149 |
misc |
1528 |
phpbb_config { "ldap_server/$lang": |
150 |
|
|
key => "ldap_server", |
151 |
misc |
1177 |
value => "ldaps://ldap.$domain", |
152 |
misc |
1147 |
} |
153 |
|
|
|
154 |
|
|
$ldap_password = extlookup("phpbb_ldap",'x') |
155 |
misc |
1528 |
phpbb_config { "ldap_password/$lang": |
156 |
|
|
key => "ldap_password", |
157 |
misc |
1147 |
value => $ldap_password, |
158 |
|
|
} |
159 |
|
|
|
160 |
misc |
1528 |
phpbb_config { "ldap_base_dn/$lang": |
161 |
|
|
key => "ldap_base_dn", |
162 |
misc |
1147 |
value => "ou=People,$dc_suffix", |
163 |
|
|
} |
164 |
misc |
1158 |
|
165 |
misc |
1528 |
phpbb_config { "auth_method/$lang": |
166 |
|
|
key => "auth_method", |
167 |
misc |
1158 |
value => "ldap", |
168 |
|
|
} |
169 |
|
|
|
170 |
misc |
1528 |
phpbb_config { "ldap_mail/$lang": |
171 |
|
|
key => "ldap_mail", |
172 |
misc |
1158 |
value => "mail", |
173 |
|
|
} |
174 |
|
|
|
175 |
misc |
1528 |
phpbb_config { "ldap_uid/$lang": |
176 |
|
|
key => "ldap_mail", |
177 |
misc |
1158 |
value => "uid", |
178 |
|
|
} |
179 |
|
|
|
180 |
misc |
1528 |
phpbb_config { "cookie_domain/$lang": |
181 |
|
|
key => "ldap_mail", |
182 |
misc |
1158 |
value => "forums.$domain", |
183 |
|
|
} |
184 |
|
|
|
185 |
misc |
1528 |
phpbb_config { "server_name/$lang": |
186 |
|
|
key => "ldap_mail", |
187 |
misc |
1158 |
value => "forums.$domain", |
188 |
|
|
} |
189 |
|
|
|
190 |
|
|
|
191 |
misc |
1072 |
} |
192 |
misc |
1053 |
} |