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