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 |
1075 |
} |
54 |
|
|
|
55 |
misc |
1152 |
define phpbb_config($value) { |
56 |
|
|
exec { "/usr/local/bin/phpbb_apply_config.pl $name": |
57 |
|
|
user => root, |
58 |
|
|
environment => ["PGDATABASE=$phpbb::base::database", |
59 |
|
|
"PGUSER=$phpbb::base::user", |
60 |
|
|
"PGPASSWORD=$phpbb::base::pgsql_password", |
61 |
|
|
"PGHOST=pgsql.$domain", |
62 |
|
|
"VALUE=$value"], |
63 |
|
|
require => File["/usr/local/bin/phpbb_apply_config.pl"], |
64 |
|
|
} |
65 |
|
|
} |
66 |
misc |
1151 |
|
67 |
|
|
# TODO find a way to avoid all the phpbb::base prefix |
68 |
|
|
define instance() { |
69 |
misc |
1161 |
include phpbb::base |
70 |
|
|
|
71 |
misc |
1148 |
$lang = $name |
72 |
misc |
1151 |
$database = "${phpbb::base::db}_$lang" |
73 |
|
|
|
74 |
misc |
1153 |
$user = $phpbb::base::user |
75 |
|
|
$pgsql_password = $phpbb::base::pgsql_password |
76 |
|
|
$forums_dir = $phpbb::base::forums_dir |
77 |
misc |
1075 |
|
78 |
misc |
1161 |
include git::client |
79 |
misc |
1167 |
exec { "git_clone $lang": |
80 |
|
|
command =>"git clone git://git.$domain/forum/ $lang", |
81 |
misc |
1147 |
cwd => $forums_dir, |
82 |
misc |
1154 |
creates => "$forums_dir/$lang", |
83 |
misc |
1169 |
require => File["$forums_dir"], |
84 |
misc |
1173 |
notify => Exec["rm_install $lang"], |
85 |
misc |
1147 |
} |
86 |
misc |
1075 |
|
87 |
misc |
1169 |
# remove this or the forum will not work ( 'board disabled' ) |
88 |
|
|
# maybe it would be better to move this elsehwere, I |
89 |
|
|
# am not sure ( and in any case, that's still in git ) |
90 |
|
|
exec { "rm_install $lang": |
91 |
misc |
1172 |
command => "rm -Rf $forums_dir/$lang/phpBB/install", |
92 |
misc |
1169 |
onlyif => "test -d $forums_dir/$lang/phpBB/install", |
93 |
|
|
} |
94 |
|
|
|
95 |
misc |
1181 |
# list found by reading ./install/install_install.php |
96 |
|
|
# end of check_server_requirements ( 2 loops ) |
97 |
misc |
1526 |
|
98 |
|
|
$writable_dirs = ['cache', |
99 |
|
|
'images/avatars/upload', |
100 |
|
|
'files', |
101 |
|
|
'store' ] |
102 |
|
|
|
103 |
|
|
$dir_names = regsubst($writable_dirs,'^',"$forums_dir/$lang/phpBB/") |
104 |
|
|
|
105 |
|
|
file { $dir_names: |
106 |
|
|
ensure => directory, |
107 |
|
|
owner => apache, |
108 |
|
|
group => root, |
109 |
|
|
mode => 755, |
110 |
|
|
require => Exec["git_clone $lang"], |
111 |
misc |
1168 |
} |
112 |
|
|
|
113 |
misc |
1147 |
file { "$forums_dir/$lang/phpBB/config.php": |
114 |
|
|
ensure => present, |
115 |
|
|
owner => root, |
116 |
|
|
group => root, |
117 |
|
|
mode => 644, |
118 |
|
|
content => template("phpbb/config.php"), |
119 |
|
|
} |
120 |
misc |
1075 |
|
121 |
|
|
|
122 |
misc |
1281 |
postgresql::remote_database { $database: |
123 |
misc |
1147 |
description => "Phpbb database", |
124 |
|
|
user => $user, |
125 |
|
|
} |
126 |
misc |
1053 |
|
127 |
misc |
1147 |
phpbb_config { "ldap_user": |
128 |
misc |
1293 |
value => "cn=phpbb-$hostname,ou=System Accounts,$dc_suffix", |
129 |
misc |
1147 |
} |
130 |
|
|
|
131 |
|
|
phpbb_config { "ldap_server": |
132 |
misc |
1177 |
value => "ldaps://ldap.$domain", |
133 |
misc |
1147 |
} |
134 |
|
|
|
135 |
|
|
$ldap_password = extlookup("phpbb_ldap",'x') |
136 |
|
|
phpbb_config { "ldap_password": |
137 |
|
|
value => $ldap_password, |
138 |
|
|
} |
139 |
|
|
|
140 |
|
|
phpbb_config { "ldap_base_dn": |
141 |
|
|
value => "ou=People,$dc_suffix", |
142 |
|
|
} |
143 |
misc |
1158 |
|
144 |
|
|
phpbb_config { "auth_method": |
145 |
|
|
value => "ldap", |
146 |
|
|
} |
147 |
|
|
|
148 |
|
|
phpbb_config { "ldap_mail": |
149 |
|
|
value => "mail", |
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
phpbb_config { "ldap_uid": |
153 |
|
|
value => "uid", |
154 |
|
|
} |
155 |
|
|
|
156 |
|
|
phpbb_config { "cookie_domain": |
157 |
|
|
value => "forums.$domain", |
158 |
|
|
} |
159 |
|
|
|
160 |
|
|
phpbb_config { "server_name": |
161 |
|
|
value => "forums.$domain", |
162 |
|
|
} |
163 |
|
|
|
164 |
|
|
|
165 |
misc |
1072 |
} |
166 |
misc |
1053 |
} |