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 |
$pgsql_password = extlookup("phpbb_pgsql",'x') |
26 |
|
|
@@postgresql::user { $user: |
27 |
|
|
password => $pgsql_password, |
28 |
|
|
} |
29 |
misc |
1053 |
|
30 |
misc |
1147 |
$forums_dir = "/var/www/forums/" |
31 |
|
|
file { "$forums_dir": |
32 |
|
|
ensure => directory, |
33 |
|
|
owner => root, |
34 |
|
|
group => root, |
35 |
|
|
} |
36 |
misc |
1158 |
# TODO add a ssl counterpart |
37 |
|
|
# TODO check that everything is locked down |
38 |
misc |
1156 |
apache::vhost_base { "forums.$domain": |
39 |
|
|
content => template("phpbb/forums_vhost.conf"), |
40 |
|
|
} |
41 |
|
|
|
42 |
misc |
1075 |
} |
43 |
|
|
|
44 |
misc |
1152 |
define phpbb_config($value) { |
45 |
|
|
exec { "/usr/local/bin/phpbb_apply_config.pl $name": |
46 |
|
|
user => root, |
47 |
|
|
environment => ["PGDATABASE=$phpbb::base::database", |
48 |
|
|
"PGUSER=$phpbb::base::user", |
49 |
|
|
"PGPASSWORD=$phpbb::base::pgsql_password", |
50 |
|
|
"PGHOST=pgsql.$domain", |
51 |
|
|
"VALUE=$value"], |
52 |
|
|
require => File["/usr/local/bin/phpbb_apply_config.pl"], |
53 |
|
|
} |
54 |
|
|
} |
55 |
misc |
1151 |
|
56 |
|
|
# TODO find a way to avoid all the phpbb::base prefix |
57 |
|
|
define instance() { |
58 |
misc |
1161 |
include phpbb::base |
59 |
|
|
|
60 |
misc |
1148 |
$lang = $name |
61 |
misc |
1151 |
$database = "${phpbb::base::db}_$lang" |
62 |
|
|
|
63 |
misc |
1153 |
$user = $phpbb::base::user |
64 |
|
|
$pgsql_password = $phpbb::base::pgsql_password |
65 |
|
|
$forums_dir = $phpbb::base::forums_dir |
66 |
misc |
1075 |
|
67 |
misc |
1161 |
include git::client |
68 |
misc |
1158 |
# TODO manage the permission of the various subdirectory |
69 |
misc |
1147 |
exec { "git clone git://git.$domain/forum/ $lang": |
70 |
|
|
cwd => $forums_dir, |
71 |
misc |
1154 |
creates => "$forums_dir/$lang", |
72 |
|
|
require => File["$forums_dir"] |
73 |
misc |
1147 |
} |
74 |
misc |
1075 |
|
75 |
misc |
1147 |
file { "$forums_dir/$lang/phpBB/config.php": |
76 |
|
|
ensure => present, |
77 |
|
|
owner => root, |
78 |
|
|
group => root, |
79 |
|
|
mode => 644, |
80 |
|
|
content => template("phpbb/config.php"), |
81 |
|
|
} |
82 |
misc |
1075 |
|
83 |
|
|
|
84 |
misc |
1147 |
@@postgresql::database { $database: |
85 |
|
|
description => "Phpbb database", |
86 |
|
|
user => $user, |
87 |
|
|
require => Postgresql::User[$user] |
88 |
|
|
} |
89 |
misc |
1053 |
|
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 |
1158 |
|
107 |
|
|
phpbb_config { "auth_method": |
108 |
|
|
value => "ldap", |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
phpbb_config { "ldap_mail": |
112 |
|
|
value => "mail", |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
phpbb_config { "ldap_uid": |
116 |
|
|
value => "uid", |
117 |
|
|
} |
118 |
|
|
|
119 |
|
|
phpbb_config { "cookie_domain": |
120 |
|
|
value => "forums.$domain", |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
phpbb_config { "server_name": |
124 |
|
|
value => "forums.$domain", |
125 |
|
|
} |
126 |
|
|
|
127 |
|
|
|
128 |
misc |
1072 |
} |
129 |
misc |
1053 |
} |