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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2243 - (hide annotations) (download)
Sat Jan 14 19:26:13 2012 UTC (12 years, 6 months ago) by misc
File size: 5499 byte(s)
run configtest before restarting or reloading apache
1 misc 1053 class phpbb {
2 misc 1147 class base {
3     $db = "phpbb"
4     $user = "phpbb"
5 misc 1053
6 misc 1147 include apache::mod_php
7 misc 1053
8 misc 1176 package { ["php-gd",
9     "php-xml",
10     "php-zlib",
11     "php-ftp",
12 misc 1625 "php-apc",
13 misc 1176 "php-magickwand",
14     "php-pgsql",
15 misc 2237 "php-ldap", ] : }
16 misc 1053
17 misc 2237 package { "perl-DBD-Pg": }
18 misc 1053
19 misc 1147 file { "/usr/local/bin/phpbb_apply_config.pl":
20     mode => 755,
21     source => 'puppet:///modules/phpbb/phpbb_apply_config.pl',
22     }
23 misc 1053
24 misc 1147 $pgsql_password = extlookup("phpbb_pgsql",'x')
25 misc 1281 postgresql::remote_user { $user:
26 misc 1147 password => $pgsql_password,
27     }
28 misc 1053
29 misc 1147 $forums_dir = "/var/www/forums/"
30     file { "$forums_dir":
31     ensure => directory,
32     }
33 misc 1158 # TODO add a ssl counterpart
34     # TODO check that everything is locked down
35 misc 1156 apache::vhost_base { "forums.$domain":
36     content => template("phpbb/forums_vhost.conf"),
37     }
38    
39 misc 1170 apache::vhost_base { "ssl_forums.$domain":
40     use_ssl => true,
41     vhost => "forums.$domain",
42     content => template("phpbb/forums_vhost.conf"),
43     }
44    
45 misc 1530 file { "/etc/httpd/conf/vhosts.d/forums.d/":
46     ensure => directory,
47     }
48    
49 misc 1075 }
50    
51 misc 1540 define phpbb_config($key, $value, $database) {
52 misc 1529 exec { "phpbb_apply $name":
53     command => "/usr/local/bin/phpbb_apply_config.pl $key",
54 misc 1152 user => root,
55 misc 1540 environment => ["PGDATABASE=$database",
56 misc 1152 "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 misc 1151
64 misc 1531 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 misc 2243 notify => Exec['service httpd configtest'],
69 misc 1531 }
70     }
71    
72 misc 1538 define databases(){
73     Phpbb::Locale_db <<| |>>
74     }
75    
76 misc 1537 define locale_db($tag = "default",
77 misc 1536 $user = $phpbb::base::user) {
78     postgresql::database { $name:
79     description => "$lang db for phpbb forum",
80     user => $user,
81     tag => $tag,
82 misc 1539 # 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 misc 1536 }
86     }
87    
88 misc 1151 # TODO find a way to avoid all the phpbb::base prefix
89     define instance() {
90 misc 1161 include phpbb::base
91    
92 misc 1148 $lang = $name
93 misc 1151 $database = "${phpbb::base::db}_$lang"
94    
95 misc 1153 $user = $phpbb::base::user
96     $pgsql_password = $phpbb::base::pgsql_password
97     $forums_dir = $phpbb::base::forums_dir
98 misc 1075
99 misc 1161 include git::client
100 misc 1167 exec { "git_clone $lang":
101     command =>"git clone git://git.$domain/forum/ $lang",
102 misc 1147 cwd => $forums_dir,
103 misc 1154 creates => "$forums_dir/$lang",
104 misc 1169 require => File["$forums_dir"],
105 misc 1173 notify => Exec["rm_install $lang"],
106 misc 1147 }
107 misc 1075
108 misc 1169 # 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 misc 1172 command => "rm -Rf $forums_dir/$lang/phpBB/install",
113 misc 1169 onlyif => "test -d $forums_dir/$lang/phpBB/install",
114     }
115    
116 misc 1181 # list found by reading ./install/install_install.php
117     # end of check_server_requirements ( 2 loops )
118 misc 1526
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 misc 1168 }
131    
132 misc 1147 file { "$forums_dir/$lang/phpBB/config.php":
133     content => template("phpbb/config.php"),
134     }
135 misc 1075
136 misc 1536 @@phpbb::locale_db { $database:
137 misc 1147 user => $user,
138     }
139 misc 1053
140 misc 2238 Phpbb_config {
141 misc 1540 database => $database,
142 misc 1147 }
143    
144     $ldap_password = extlookup("phpbb_ldap",'x')
145    
146 misc 2238 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 misc 1147 }
168 misc 1158
169 misc 1072 }
170 misc 1053 }

  ViewVC Help
Powered by ViewVC 1.1.30