1 |
class phpbb { |
class phpbb { |
2 |
$database = "phpbb" |
class base { |
3 |
$user = "phpbb" |
$db = "phpbb" |
4 |
|
$user = "phpbb" |
5 |
|
|
6 |
include apache::mod_php |
include apache::mod_php |
7 |
include mysql |
include mysql |
8 |
|
|
9 |
package { ["php-gd","php-xml","php-zlib","php-ftp","php-magickwand","php-pgsql" ] : |
package { ["php-gd","php-xml","php-zlib","php-ftp","php-magickwand","php-pgsql" ] : |
10 |
ensure => installed |
ensure => installed |
11 |
} |
} |
12 |
|
|
13 |
package { "perl-DBD-Pg": |
package { "perl-DBD-Pg": |
14 |
ensure => installed |
ensure => installed |
15 |
} |
} |
16 |
|
|
17 |
file { "/usr/local/bin/phpbb_apply_config.pl": |
file { "/usr/local/bin/phpbb_apply_config.pl": |
18 |
ensure => present, |
ensure => present, |
19 |
owner => root, |
owner => root, |
20 |
group => root, |
group => root, |
21 |
mode => 755, |
mode => 755, |
22 |
source => 'puppet:///modules/phpbb/phpbb_apply_config.pl', |
source => 'puppet:///modules/phpbb/phpbb_apply_config.pl', |
23 |
} |
} |
24 |
|
|
25 |
# TODO phpbb config |
# TODO phpbb config |
26 |
# cookie_domain |
# cookie_domain |
27 |
# board_contact |
# board_contact |
28 |
# |
# |
29 |
define phpbb_config($value) { |
define phpbb_config($value) { |
30 |
exec { "/usr/local/bin/phpbb_apply_config.pl $name": |
exec { "/usr/local/bin/phpbb_apply_config.pl $name": |
31 |
user => root, |
user => root, |
32 |
environment => ["PGDATABASE=$database", "PGUSER=$user", "PGPASSWORD=$pgsql_password", "PGHOST=pgsql.$domain", "VALUE=$value"], |
environment => ["PGDATABASE=$database", "PGUSER=$user", "PGPASSWORD=$pgsql_password", "PGHOST=pgsql.$domain", "VALUE=$value"], |
33 |
require => File["/usr/local/bin/phpbb_apply_config.pl"], |
require => File["/usr/local/bin/phpbb_apply_config.pl"], |
34 |
|
} |
35 |
} |
} |
|
} |
|
36 |
|
|
37 |
phpbb_config { "ldap_user": |
$pgsql_password = extlookup("phpbb_pgsql",'x') |
38 |
value => "cn=phpbb-friteuse,ou=System Accounts,$dc_suffix", |
@@postgresql::user { $user: |
39 |
} |
password => $pgsql_password, |
40 |
|
} |
41 |
|
|
42 |
phpbb_config { "ldap_server": |
$forums_dir = "/var/www/forums/" |
43 |
value => "ldap.$domain", |
file { "$forums_dir": |
44 |
|
ensure => directory, |
45 |
|
owner => root, |
46 |
|
group => root, |
47 |
|
} |
48 |
} |
} |
49 |
|
|
50 |
$ldap_password = extlookup("phpbb_ldap",'x') |
define php_instance($lang) { |
51 |
phpbb_config { "ldap_password": |
$database = "${db}_$lang" |
|
value => $ldap_password, |
|
|
} |
|
52 |
|
|
53 |
phpbb_config { "ldap_base_dn": |
include git::client |
|
value => "ou=People,$dc_suffix", |
|
|
} |
|
54 |
|
|
55 |
|
exec { "git clone git://git.$domain/forum/ $lang": |
56 |
|
cwd => $forums_dir, |
57 |
|
creates => "$forums_dir/$lang", |
58 |
|
} |
59 |
|
|
60 |
|
file { "$forums_dir/$lang/phpBB/config.php": |
61 |
|
ensure => present, |
62 |
|
owner => root, |
63 |
|
group => root, |
64 |
|
mode => 644, |
65 |
|
content => template("phpbb/config.php"), |
66 |
|
} |
67 |
|
|
68 |
# TODO git checkout of the code |
include php::base |
|
include git::client |
|
69 |
|
|
70 |
# TODO phpbb database configuration |
@@postgresql::database { $database: |
71 |
$pgsql_password = extlookup("phpbb_pgsql",'x') |
description => "Phpbb database", |
72 |
@@postgresql::user { $user: |
user => $user, |
73 |
password => $pgsql_password, |
require => Postgresql::User[$user] |
74 |
} |
} |
75 |
|
|
76 |
|
|
77 |
|
phpbb_config { "ldap_user": |
78 |
|
value => "cn=phpbb-friteuse,ou=System Accounts,$dc_suffix", |
79 |
|
} |
80 |
|
|
81 |
|
phpbb_config { "ldap_server": |
82 |
|
value => "ldap.$domain", |
83 |
|
} |
84 |
|
|
85 |
@@postgresql::database { $database: |
$ldap_password = extlookup("phpbb_ldap",'x') |
86 |
description => "Phpbb database", |
phpbb_config { "ldap_password": |
87 |
user => $user, |
value => $ldap_password, |
88 |
require => Postgresql::User[$user] |
} |
89 |
|
|
90 |
|
phpbb_config { "ldap_base_dn": |
91 |
|
value => "ou=People,$dc_suffix", |
92 |
|
} |
93 |
} |
} |
94 |
} |
} |