/[adm]/puppet/modules/phpbb/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/phpbb/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1420 - (show annotations) (download)
Tue Mar 29 20:15:08 2011 UTC (13 years ago) by misc
File size: 4708 byte(s)
- remove incorrect requirement of mysql, as found out by pascal

1 class phpbb {
2 class base {
3 $db = "phpbb"
4 $user = "phpbb"
5
6 include apache::mod_php
7
8 package { ["php-gd",
9 "php-xml",
10 "php-zlib",
11 "php-ftp",
12 "php-magickwand",
13 "php-pgsql",
14 "php-ldap", ] :
15 ensure => installed
16 }
17
18 package { "perl-DBD-Pg":
19 ensure => installed
20 }
21
22 file { "/usr/local/bin/phpbb_apply_config.pl":
23 ensure => present,
24 owner => root,
25 group => root,
26 mode => 755,
27 source => 'puppet:///modules/phpbb/phpbb_apply_config.pl',
28 }
29
30 $pgsql_password = extlookup("phpbb_pgsql",'x')
31 postgresql::remote_user { $user:
32 password => $pgsql_password,
33 }
34
35 $forums_dir = "/var/www/forums/"
36 file { "$forums_dir":
37 ensure => directory,
38 owner => root,
39 group => root,
40 }
41 # TODO add a ssl counterpart
42 # TODO check that everything is locked down
43 apache::vhost_base { "forums.$domain":
44 content => template("phpbb/forums_vhost.conf"),
45 }
46
47 apache::vhost_base { "ssl_forums.$domain":
48 use_ssl => true,
49 vhost => "forums.$domain",
50 content => template("phpbb/forums_vhost.conf"),
51 }
52
53 }
54
55 define phpbb_config($value) {
56 exec { "/usr/local/bin/phpbb_apply_config.pl $name":
57 user => root,
58 environment => ["PGDATABASE=$phpbb::base::database",
59 "PGUSER=$phpbb::base::user",
60 "PGPASSWORD=$phpbb::base::pgsql_password",
61 "PGHOST=pgsql.$domain",
62 "VALUE=$value"],
63 require => File["/usr/local/bin/phpbb_apply_config.pl"],
64 }
65 }
66
67 define apache_writable_dir() {
68 file { "$forums_dir/$lang/phpBB/$name":
69 ensure => directory,
70 owner => apache,
71 group => root,
72 mode => 755,
73 require => Exec["git_clone $lang"],
74 }
75 }
76
77 # TODO find a way to avoid all the phpbb::base prefix
78 define instance() {
79 include phpbb::base
80
81 $lang = $name
82 $database = "${phpbb::base::db}_$lang"
83
84 $user = $phpbb::base::user
85 $pgsql_password = $phpbb::base::pgsql_password
86 $forums_dir = $phpbb::base::forums_dir
87
88 include git::client
89 exec { "git_clone $lang":
90 command =>"git clone git://git.$domain/forum/ $lang",
91 cwd => $forums_dir,
92 creates => "$forums_dir/$lang",
93 require => File["$forums_dir"],
94 notify => Exec["rm_install $lang"],
95 }
96
97 # remove this or the forum will not work ( 'board disabled' )
98 # maybe it would be better to move this elsehwere, I
99 # am not sure ( and in any case, that's still in git )
100 exec { "rm_install $lang":
101 command => "rm -Rf $forums_dir/$lang/phpBB/install",
102 onlyif => "test -d $forums_dir/$lang/phpBB/install",
103 }
104
105 # list found by reading ./install/install_install.php
106 # end of check_server_requirements ( 2 loops )
107 apache_writable_dir { ['cache',
108 'images/avatars/upload',
109 'files',
110 'store' ]:
111 }
112
113 file { "$forums_dir/$lang/phpBB/config.php":
114 ensure => present,
115 owner => root,
116 group => root,
117 mode => 644,
118 content => template("phpbb/config.php"),
119 }
120
121
122 postgresql::remote_database { $database:
123 description => "Phpbb database",
124 user => $user,
125 }
126
127 phpbb_config { "ldap_user":
128 value => "cn=phpbb-$hostname,ou=System Accounts,$dc_suffix",
129 }
130
131 phpbb_config { "ldap_server":
132 value => "ldaps://ldap.$domain",
133 }
134
135 $ldap_password = extlookup("phpbb_ldap",'x')
136 phpbb_config { "ldap_password":
137 value => $ldap_password,
138 }
139
140 phpbb_config { "ldap_base_dn":
141 value => "ou=People,$dc_suffix",
142 }
143
144 phpbb_config { "auth_method":
145 value => "ldap",
146 }
147
148 phpbb_config { "ldap_mail":
149 value => "mail",
150 }
151
152 phpbb_config { "ldap_uid":
153 value => "uid",
154 }
155
156 phpbb_config { "cookie_domain":
157 value => "forums.$domain",
158 }
159
160 phpbb_config { "server_name":
161 value => "forums.$domain",
162 }
163
164
165 }
166 }

  ViewVC Help
Powered by ViewVC 1.1.30