/[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 1539 - (show annotations) (download)
Tue Apr 19 11:48:37 2011 UTC (10 years, 9 months ago) by misc
File size: 5994 byte(s)
disable requires, as alamut complain

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 file { "/etc/httpd/conf/vhosts.d/forums.d/":
54 ensure => directory,
55 }
56
57 }
58
59 define phpbb_config($key, $value) {
60 exec { "phpbb_apply $name":
61 command => "/usr/local/bin/phpbb_apply_config.pl $key",
62 user => root,
63 environment => ["PGDATABASE=$phpbb::base::database",
64 "PGUSER=$phpbb::base::user",
65 "PGPASSWORD=$phpbb::base::pgsql_password",
66 "PGHOST=pgsql.$domain",
67 "VALUE=$value"],
68 require => File["/usr/local/bin/phpbb_apply_config.pl"],
69 }
70 }
71
72 define redirection_instance($url) {
73 $lang = $name
74 file { "/etc/httpd/conf/vhosts.d/forums.d/redirect_$name.conf":
75 ensure => present,
76 owner => root,
77 group => root,
78 mode => 644,
79 content => template("phpbb/forums_redirect.conf"),
80 notify => Service['apache'],
81 }
82 }
83
84 define databases(){
85 Phpbb::Locale_db <<| |>>
86 }
87
88 define locale_db($tag = "default",
89 $user = $phpbb::base::user) {
90 postgresql::database { $name:
91 description => "$lang db for phpbb forum",
92 user => $user,
93 tag => $tag,
94 # this break due to the way it is remotely declared
95 # this should only be a issue in case of bootstrapping again
96 # require => Postgresql::User[$user]
97 }
98 }
99
100 # TODO find a way to avoid all the phpbb::base prefix
101 define instance() {
102 include phpbb::base
103
104 $lang = $name
105 $database = "${phpbb::base::db}_$lang"
106
107 $user = $phpbb::base::user
108 $pgsql_password = $phpbb::base::pgsql_password
109 $forums_dir = $phpbb::base::forums_dir
110
111 include git::client
112 exec { "git_clone $lang":
113 command =>"git clone git://git.$domain/forum/ $lang",
114 cwd => $forums_dir,
115 creates => "$forums_dir/$lang",
116 require => File["$forums_dir"],
117 notify => Exec["rm_install $lang"],
118 }
119
120 # remove this or the forum will not work ( 'board disabled' )
121 # maybe it would be better to move this elsehwere, I
122 # am not sure ( and in any case, that's still in git )
123 exec { "rm_install $lang":
124 command => "rm -Rf $forums_dir/$lang/phpBB/install",
125 onlyif => "test -d $forums_dir/$lang/phpBB/install",
126 }
127
128 # list found by reading ./install/install_install.php
129 # end of check_server_requirements ( 2 loops )
130
131 $writable_dirs = ['cache',
132 'images/avatars/upload',
133 'files',
134 'store' ]
135
136 $dir_names = regsubst($writable_dirs,'^',"$forums_dir/$lang/phpBB/")
137
138 file { $dir_names:
139 ensure => directory,
140 owner => apache,
141 group => root,
142 mode => 755,
143 require => Exec["git_clone $lang"],
144 }
145
146 file { "$forums_dir/$lang/phpBB/config.php":
147 ensure => present,
148 owner => root,
149 group => root,
150 mode => 644,
151 content => template("phpbb/config.php"),
152 }
153
154 @@phpbb::locale_db { $database:
155 user => $user,
156 }
157
158 phpbb_config { "ldap_user/$lang":
159 key => "ldap_user",
160 value => "cn=phpbb-$hostname,ou=System Accounts,$dc_suffix",
161 }
162
163 phpbb_config { "ldap_server/$lang":
164 key => "ldap_server",
165 value => "ldaps://ldap.$domain",
166 }
167
168 $ldap_password = extlookup("phpbb_ldap",'x')
169 phpbb_config { "ldap_password/$lang":
170 key => "ldap_password",
171 value => $ldap_password,
172 }
173
174 phpbb_config { "ldap_base_dn/$lang":
175 key => "ldap_base_dn",
176 value => "ou=People,$dc_suffix",
177 }
178
179 phpbb_config { "auth_method/$lang":
180 key => "auth_method",
181 value => "ldap",
182 }
183
184 phpbb_config { "ldap_mail/$lang":
185 key => "ldap_mail",
186 value => "mail",
187 }
188
189 phpbb_config { "ldap_uid/$lang":
190 key => "ldap_mail",
191 value => "uid",
192 }
193
194 phpbb_config { "cookie_domain/$lang":
195 key => "ldap_mail",
196 value => "forums.$domain",
197 }
198
199 phpbb_config { "server_name/$lang":
200 key => "ldap_mail",
201 value => "forums.$domain",
202 }
203
204
205 }
206 }

  ViewVC Help
Powered by ViewVC 1.1.28