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