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 |
1147 |
package { ["php-gd","php-xml","php-zlib","php-ftp","php-magickwand","php-pgsql" ] : |
10 |
|
|
ensure => installed |
11 |
|
|
} |
12 |
misc |
1053 |
|
13 |
misc |
1147 |
package { "perl-DBD-Pg": |
14 |
|
|
ensure => installed |
15 |
|
|
} |
16 |
misc |
1053 |
|
17 |
misc |
1147 |
file { "/usr/local/bin/phpbb_apply_config.pl": |
18 |
|
|
ensure => present, |
19 |
|
|
owner => root, |
20 |
|
|
group => root, |
21 |
|
|
mode => 755, |
22 |
|
|
source => 'puppet:///modules/phpbb/phpbb_apply_config.pl', |
23 |
|
|
} |
24 |
misc |
1053 |
|
25 |
misc |
1147 |
# TODO phpbb config |
26 |
|
|
# cookie_domain |
27 |
|
|
# board_contact |
28 |
|
|
# |
29 |
|
|
define phpbb_config($value) { |
30 |
|
|
exec { "/usr/local/bin/phpbb_apply_config.pl $name": |
31 |
|
|
user => root, |
32 |
|
|
environment => ["PGDATABASE=$database", "PGUSER=$user", "PGPASSWORD=$pgsql_password", "PGHOST=pgsql.$domain", "VALUE=$value"], |
33 |
|
|
require => File["/usr/local/bin/phpbb_apply_config.pl"], |
34 |
|
|
} |
35 |
misc |
1074 |
} |
36 |
|
|
|
37 |
misc |
1147 |
$pgsql_password = extlookup("phpbb_pgsql",'x') |
38 |
|
|
@@postgresql::user { $user: |
39 |
|
|
password => $pgsql_password, |
40 |
|
|
} |
41 |
misc |
1053 |
|
42 |
misc |
1147 |
$forums_dir = "/var/www/forums/" |
43 |
|
|
file { "$forums_dir": |
44 |
|
|
ensure => directory, |
45 |
|
|
owner => root, |
46 |
|
|
group => root, |
47 |
|
|
} |
48 |
misc |
1075 |
} |
49 |
|
|
|
50 |
misc |
1151 |
|
51 |
|
|
# TODO find a way to avoid all the phpbb::base prefix |
52 |
|
|
define instance() { |
53 |
misc |
1148 |
$lang = $name |
54 |
misc |
1151 |
$database = "${phpbb::base::db}_$lang" |
55 |
|
|
|
56 |
misc |
1147 |
include git::client |
57 |
misc |
1150 |
include phpbb::base |
58 |
misc |
1075 |
|
59 |
misc |
1147 |
exec { "git clone git://git.$domain/forum/ $lang": |
60 |
|
|
cwd => $forums_dir, |
61 |
|
|
creates => "$forums_dir/$lang", |
62 |
|
|
} |
63 |
misc |
1075 |
|
64 |
misc |
1147 |
file { "$forums_dir/$lang/phpBB/config.php": |
65 |
|
|
ensure => present, |
66 |
|
|
owner => root, |
67 |
|
|
group => root, |
68 |
|
|
mode => 644, |
69 |
|
|
content => template("phpbb/config.php"), |
70 |
|
|
} |
71 |
misc |
1075 |
|
72 |
|
|
|
73 |
misc |
1147 |
@@postgresql::database { $database: |
74 |
|
|
description => "Phpbb database", |
75 |
|
|
user => $user, |
76 |
|
|
require => Postgresql::User[$user] |
77 |
|
|
} |
78 |
misc |
1053 |
|
79 |
misc |
1149 |
# TODO server_name => forums.$domain |
80 |
|
|
# cookie_domain => forums.$domain |
81 |
|
|
# auth_method => ldap |
82 |
|
|
# ldap_uid => uid |
83 |
|
|
# ldap_mail => mail |
84 |
misc |
1147 |
phpbb_config { "ldap_user": |
85 |
|
|
value => "cn=phpbb-friteuse,ou=System Accounts,$dc_suffix", |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
phpbb_config { "ldap_server": |
89 |
|
|
value => "ldap.$domain", |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
$ldap_password = extlookup("phpbb_ldap",'x') |
93 |
|
|
phpbb_config { "ldap_password": |
94 |
|
|
value => $ldap_password, |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
phpbb_config { "ldap_base_dn": |
98 |
|
|
value => "ou=People,$dc_suffix", |
99 |
|
|
} |
100 |
misc |
1072 |
} |
101 |
misc |
1053 |
} |