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