1 |
class phpbb { |
2 |
class base { |
3 |
$db = "phpbb" |
4 |
$user = "phpbb" |
5 |
|
6 |
include apache::mod_php |
7 |
include mysql |
8 |
|
9 |
package { ["php-gd","php-xml","php-zlib","php-ftp","php-magickwand","php-pgsql" ] : |
10 |
ensure => installed |
11 |
} |
12 |
|
13 |
package { "perl-DBD-Pg": |
14 |
ensure => installed |
15 |
} |
16 |
|
17 |
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 |
|
25 |
# 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 |
|
34 |
$forums_dir = "/var/www/forums/" |
35 |
file { "$forums_dir": |
36 |
ensure => directory, |
37 |
owner => root, |
38 |
group => root, |
39 |
} |
40 |
} |
41 |
|
42 |
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 |
|
54 |
# TODO find a way to avoid all the phpbb::base prefix |
55 |
define instance() { |
56 |
$lang = $name |
57 |
$database = "${phpbb::base::db}_$lang" |
58 |
|
59 |
include git::client |
60 |
include phpbb::base |
61 |
|
62 |
exec { "git clone git://git.$domain/forum/ $lang": |
63 |
cwd => $forums_dir, |
64 |
creates => "$forums_dir/$lang", |
65 |
} |
66 |
|
67 |
file { "$forums_dir/$lang/phpBB/config.php": |
68 |
ensure => present, |
69 |
owner => root, |
70 |
group => root, |
71 |
mode => 644, |
72 |
content => template("phpbb/config.php"), |
73 |
} |
74 |
|
75 |
|
76 |
@@postgresql::database { $database: |
77 |
description => "Phpbb database", |
78 |
user => $user, |
79 |
require => Postgresql::User[$user] |
80 |
} |
81 |
|
82 |
# TODO server_name => forums.$domain |
83 |
# cookie_domain => forums.$domain |
84 |
# auth_method => ldap |
85 |
# ldap_uid => uid |
86 |
# ldap_mail => mail |
87 |
phpbb_config { "ldap_user": |
88 |
value => "cn=phpbb-friteuse,ou=System Accounts,$dc_suffix", |
89 |
} |
90 |
|
91 |
phpbb_config { "ldap_server": |
92 |
value => "ldap.$domain", |
93 |
} |
94 |
|
95 |
$ldap_password = extlookup("phpbb_ldap",'x') |
96 |
phpbb_config { "ldap_password": |
97 |
value => $ldap_password, |
98 |
} |
99 |
|
100 |
phpbb_config { "ldap_base_dn": |
101 |
value => "ou=People,$dc_suffix", |
102 |
} |
103 |
} |
104 |
} |