/[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 1529 - (hide annotations) (download)
Tue Apr 19 09:50:07 2011 UTC (13 years ago) by misc
File size: 5100 byte(s)
- also do make sure that the phpbb_apply can be declared multiple time

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

  ViewVC Help
Powered by ViewVC 1.1.30