/[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 1536 - (show annotations) (download)
Tue Apr 19 11:20:27 2011 UTC (11 years, 1 month ago) by misc
File size: 5805 byte(s)
declare phpbb database using a different type, so this can be then used
on postgresql side to declare access on the database

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 locale_db($tag = "default"
85 $user = $phpbb::base::user) {
86 postgresql::database { $name:
87 description => "$lang db for phpbb forum",
88 user => $user,
89 tag => $tag,
90 require => Postgresql::User[$user]
91 }
92 }
93
94 # TODO find a way to avoid all the phpbb::base prefix
95 define instance() {
96 include phpbb::base
97
98 $lang = $name
99 $database = "${phpbb::base::db}_$lang"
100
101 $user = $phpbb::base::user
102 $pgsql_password = $phpbb::base::pgsql_password
103 $forums_dir = $phpbb::base::forums_dir
104
105 include git::client
106 exec { "git_clone $lang":
107 command =>"git clone git://git.$domain/forum/ $lang",
108 cwd => $forums_dir,
109 creates => "$forums_dir/$lang",
110 require => File["$forums_dir"],
111 notify => Exec["rm_install $lang"],
112 }
113
114 # remove this or the forum will not work ( 'board disabled' )
115 # maybe it would be better to move this elsehwere, I
116 # am not sure ( and in any case, that's still in git )
117 exec { "rm_install $lang":
118 command => "rm -Rf $forums_dir/$lang/phpBB/install",
119 onlyif => "test -d $forums_dir/$lang/phpBB/install",
120 }
121
122 # list found by reading ./install/install_install.php
123 # end of check_server_requirements ( 2 loops )
124
125 $writable_dirs = ['cache',
126 'images/avatars/upload',
127 'files',
128 'store' ]
129
130 $dir_names = regsubst($writable_dirs,'^',"$forums_dir/$lang/phpBB/")
131
132 file { $dir_names:
133 ensure => directory,
134 owner => apache,
135 group => root,
136 mode => 755,
137 require => Exec["git_clone $lang"],
138 }
139
140 file { "$forums_dir/$lang/phpBB/config.php":
141 ensure => present,
142 owner => root,
143 group => root,
144 mode => 644,
145 content => template("phpbb/config.php"),
146 }
147
148 @@phpbb::locale_db { $database:
149 user => $user,
150 }
151
152 phpbb_config { "ldap_user/$lang":
153 key => "ldap_user",
154 value => "cn=phpbb-$hostname,ou=System Accounts,$dc_suffix",
155 }
156
157 phpbb_config { "ldap_server/$lang":
158 key => "ldap_server",
159 value => "ldaps://ldap.$domain",
160 }
161
162 $ldap_password = extlookup("phpbb_ldap",'x')
163 phpbb_config { "ldap_password/$lang":
164 key => "ldap_password",
165 value => $ldap_password,
166 }
167
168 phpbb_config { "ldap_base_dn/$lang":
169 key => "ldap_base_dn",
170 value => "ou=People,$dc_suffix",
171 }
172
173 phpbb_config { "auth_method/$lang":
174 key => "auth_method",
175 value => "ldap",
176 }
177
178 phpbb_config { "ldap_mail/$lang":
179 key => "ldap_mail",
180 value => "mail",
181 }
182
183 phpbb_config { "ldap_uid/$lang":
184 key => "ldap_mail",
185 value => "uid",
186 }
187
188 phpbb_config { "cookie_domain/$lang":
189 key => "ldap_mail",
190 value => "forums.$domain",
191 }
192
193 phpbb_config { "server_name/$lang":
194 key => "ldap_mail",
195 value => "forums.$domain",
196 }
197
198
199 }
200 }

  ViewVC Help
Powered by ViewVC 1.1.28