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

  ViewVC Help
Powered by ViewVC 1.1.30