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 |
|
|
include mysql |
8 |
misc |
1053 |
|
9 |
misc |
1176 |
package { ["php-gd", |
10 |
|
|
"php-xml", |
11 |
|
|
"php-zlib", |
12 |
|
|
"php-ftp", |
13 |
|
|
"php-magickwand", |
14 |
|
|
"php-pgsql", |
15 |
|
|
"php-ldap", ] : |
16 |
misc |
1147 |
ensure => installed |
17 |
|
|
} |
18 |
misc |
1053 |
|
19 |
misc |
1147 |
package { "perl-DBD-Pg": |
20 |
|
|
ensure => installed |
21 |
|
|
} |
22 |
misc |
1053 |
|
23 |
misc |
1147 |
file { "/usr/local/bin/phpbb_apply_config.pl": |
24 |
|
|
ensure => present, |
25 |
|
|
owner => root, |
26 |
|
|
group => root, |
27 |
|
|
mode => 755, |
28 |
|
|
source => 'puppet:///modules/phpbb/phpbb_apply_config.pl', |
29 |
|
|
} |
30 |
misc |
1053 |
|
31 |
misc |
1147 |
$pgsql_password = extlookup("phpbb_pgsql",'x') |
32 |
|
|
@@postgresql::user { $user: |
33 |
|
|
password => $pgsql_password, |
34 |
|
|
} |
35 |
misc |
1053 |
|
36 |
misc |
1147 |
$forums_dir = "/var/www/forums/" |
37 |
|
|
file { "$forums_dir": |
38 |
|
|
ensure => directory, |
39 |
|
|
owner => root, |
40 |
|
|
group => root, |
41 |
|
|
} |
42 |
misc |
1158 |
# TODO add a ssl counterpart |
43 |
|
|
# TODO check that everything is locked down |
44 |
misc |
1156 |
apache::vhost_base { "forums.$domain": |
45 |
|
|
content => template("phpbb/forums_vhost.conf"), |
46 |
|
|
} |
47 |
|
|
|
48 |
misc |
1170 |
apache::vhost_base { "ssl_forums.$domain": |
49 |
|
|
use_ssl => true, |
50 |
|
|
vhost => "forums.$domain", |
51 |
|
|
content => template("phpbb/forums_vhost.conf"), |
52 |
|
|
} |
53 |
|
|
|
54 |
misc |
1075 |
} |
55 |
|
|
|
56 |
misc |
1152 |
define phpbb_config($value) { |
57 |
|
|
exec { "/usr/local/bin/phpbb_apply_config.pl $name": |
58 |
|
|
user => root, |
59 |
|
|
environment => ["PGDATABASE=$phpbb::base::database", |
60 |
|
|
"PGUSER=$phpbb::base::user", |
61 |
|
|
"PGPASSWORD=$phpbb::base::pgsql_password", |
62 |
|
|
"PGHOST=pgsql.$domain", |
63 |
|
|
"VALUE=$value"], |
64 |
|
|
require => File["/usr/local/bin/phpbb_apply_config.pl"], |
65 |
|
|
} |
66 |
|
|
} |
67 |
misc |
1151 |
|
68 |
|
|
# TODO find a way to avoid all the phpbb::base prefix |
69 |
|
|
define instance() { |
70 |
misc |
1161 |
include phpbb::base |
71 |
|
|
|
72 |
misc |
1148 |
$lang = $name |
73 |
misc |
1151 |
$database = "${phpbb::base::db}_$lang" |
74 |
|
|
|
75 |
misc |
1153 |
$user = $phpbb::base::user |
76 |
|
|
$pgsql_password = $phpbb::base::pgsql_password |
77 |
|
|
$forums_dir = $phpbb::base::forums_dir |
78 |
misc |
1075 |
|
79 |
misc |
1161 |
include git::client |
80 |
misc |
1167 |
exec { "git_clone $lang": |
81 |
|
|
command =>"git clone git://git.$domain/forum/ $lang", |
82 |
misc |
1147 |
cwd => $forums_dir, |
83 |
misc |
1154 |
creates => "$forums_dir/$lang", |
84 |
misc |
1169 |
require => File["$forums_dir"], |
85 |
misc |
1173 |
notify => Exec["rm_install $lang"], |
86 |
misc |
1147 |
} |
87 |
misc |
1075 |
|
88 |
misc |
1169 |
# remove this or the forum will not work ( 'board disabled' ) |
89 |
|
|
# maybe it would be better to move this elsehwere, I |
90 |
|
|
# am not sure ( and in any case, that's still in git ) |
91 |
|
|
exec { "rm_install $lang": |
92 |
misc |
1172 |
command => "rm -Rf $forums_dir/$lang/phpBB/install", |
93 |
misc |
1169 |
onlyif => "test -d $forums_dir/$lang/phpBB/install", |
94 |
|
|
} |
95 |
|
|
|
96 |
misc |
1168 |
# TODO manage the permission of the various subdirectories |
97 |
|
|
$writable_dir = ['cache'] |
98 |
|
|
file { "$forums_dir/$lang/phpBB/$writable_dir": |
99 |
|
|
ensure => directory, |
100 |
|
|
owner => apache, |
101 |
|
|
group => root, |
102 |
|
|
mode => 755, |
103 |
|
|
require => Exec["git_clone $lang"], |
104 |
|
|
} |
105 |
|
|
|
106 |
misc |
1147 |
file { "$forums_dir/$lang/phpBB/config.php": |
107 |
|
|
ensure => present, |
108 |
|
|
owner => root, |
109 |
|
|
group => root, |
110 |
|
|
mode => 644, |
111 |
|
|
content => template("phpbb/config.php"), |
112 |
|
|
} |
113 |
misc |
1075 |
|
114 |
|
|
|
115 |
misc |
1147 |
@@postgresql::database { $database: |
116 |
|
|
description => "Phpbb database", |
117 |
|
|
user => $user, |
118 |
|
|
require => Postgresql::User[$user] |
119 |
|
|
} |
120 |
misc |
1053 |
|
121 |
misc |
1147 |
phpbb_config { "ldap_user": |
122 |
|
|
value => "cn=phpbb-friteuse,ou=System Accounts,$dc_suffix", |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
phpbb_config { "ldap_server": |
126 |
|
|
value => "ldap.$domain", |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
$ldap_password = extlookup("phpbb_ldap",'x') |
130 |
|
|
phpbb_config { "ldap_password": |
131 |
|
|
value => $ldap_password, |
132 |
|
|
} |
133 |
|
|
|
134 |
|
|
phpbb_config { "ldap_base_dn": |
135 |
|
|
value => "ou=People,$dc_suffix", |
136 |
|
|
} |
137 |
misc |
1158 |
|
138 |
|
|
phpbb_config { "auth_method": |
139 |
|
|
value => "ldap", |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
phpbb_config { "ldap_mail": |
143 |
|
|
value => "mail", |
144 |
|
|
} |
145 |
|
|
|
146 |
|
|
phpbb_config { "ldap_uid": |
147 |
|
|
value => "uid", |
148 |
|
|
} |
149 |
|
|
|
150 |
|
|
phpbb_config { "cookie_domain": |
151 |
|
|
value => "forums.$domain", |
152 |
|
|
} |
153 |
|
|
|
154 |
|
|
phpbb_config { "server_name": |
155 |
|
|
value => "forums.$domain", |
156 |
|
|
} |
157 |
|
|
|
158 |
|
|
|
159 |
misc |
1072 |
} |
160 |
misc |
1053 |
} |