/[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 1293 - (show annotations) (download)
Tue Mar 8 16:03:12 2011 UTC (13 years ago) by misc
File size: 4730 byte(s)
- and again, do not hardcode server name, as this would cause problem if we 
move to another server

1 class phpbb {
2 class base {
3 $db = "phpbb"
4 $user = "phpbb"
5
6 include apache::mod_php
7 include mysql
8
9 package { ["php-gd",
10 "php-xml",
11 "php-zlib",
12 "php-ftp",
13 "php-magickwand",
14 "php-pgsql",
15 "php-ldap", ] :
16 ensure => installed
17 }
18
19 package { "perl-DBD-Pg":
20 ensure => installed
21 }
22
23 file { "/usr/local/bin/phpbb_apply_config.pl":
24 ensure => present,
25 owner => root,
26 group => root,
27 mode => 755,
28 source => 'puppet:///modules/phpbb/phpbb_apply_config.pl',
29 }
30
31 $pgsql_password = extlookup("phpbb_pgsql",'x')
32 postgresql::remote_user { $user:
33 password => $pgsql_password,
34 }
35
36 $forums_dir = "/var/www/forums/"
37 file { "$forums_dir":
38 ensure => directory,
39 owner => root,
40 group => root,
41 }
42 # TODO add a ssl counterpart
43 # TODO check that everything is locked down
44 apache::vhost_base { "forums.$domain":
45 content => template("phpbb/forums_vhost.conf"),
46 }
47
48 apache::vhost_base { "ssl_forums.$domain":
49 use_ssl => true,
50 vhost => "forums.$domain",
51 content => template("phpbb/forums_vhost.conf"),
52 }
53
54 }
55
56 define phpbb_config($value) {
57 exec { "/usr/local/bin/phpbb_apply_config.pl $name":
58 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
68 define apache_writable_dir() {
69 file { "$forums_dir/$lang/phpBB/$name":
70 ensure => directory,
71 owner => apache,
72 group => root,
73 mode => 755,
74 require => Exec["git_clone $lang"],
75 }
76 }
77
78 # TODO find a way to avoid all the phpbb::base prefix
79 define instance() {
80 include phpbb::base
81
82 $lang = $name
83 $database = "${phpbb::base::db}_$lang"
84
85 $user = $phpbb::base::user
86 $pgsql_password = $phpbb::base::pgsql_password
87 $forums_dir = $phpbb::base::forums_dir
88
89 include git::client
90 exec { "git_clone $lang":
91 command =>"git clone git://git.$domain/forum/ $lang",
92 cwd => $forums_dir,
93 creates => "$forums_dir/$lang",
94 require => File["$forums_dir"],
95 notify => Exec["rm_install $lang"],
96 }
97
98 # remove this or the forum will not work ( 'board disabled' )
99 # maybe it would be better to move this elsehwere, I
100 # am not sure ( and in any case, that's still in git )
101 exec { "rm_install $lang":
102 command => "rm -Rf $forums_dir/$lang/phpBB/install",
103 onlyif => "test -d $forums_dir/$lang/phpBB/install",
104 }
105
106 # list found by reading ./install/install_install.php
107 # end of check_server_requirements ( 2 loops )
108 apache_writable_dir { ['cache',
109 'images/avatars/upload',
110 'files',
111 'store' ]:
112 }
113
114 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
122
123 postgresql::remote_database { $database:
124 description => "Phpbb database",
125 user => $user,
126 }
127
128 phpbb_config { "ldap_user":
129 value => "cn=phpbb-$hostname,ou=System Accounts,$dc_suffix",
130 }
131
132 phpbb_config { "ldap_server":
133 value => "ldaps://ldap.$domain",
134 }
135
136 $ldap_password = extlookup("phpbb_ldap",'x')
137 phpbb_config { "ldap_password":
138 value => $ldap_password,
139 }
140
141 phpbb_config { "ldap_base_dn":
142 value => "ou=People,$dc_suffix",
143 }
144
145 phpbb_config { "auth_method":
146 value => "ldap",
147 }
148
149 phpbb_config { "ldap_mail":
150 value => "mail",
151 }
152
153 phpbb_config { "ldap_uid":
154 value => "uid",
155 }
156
157 phpbb_config { "cookie_domain":
158 value => "forums.$domain",
159 }
160
161 phpbb_config { "server_name":
162 value => "forums.$domain",
163 }
164
165
166 }
167 }

  ViewVC Help
Powered by ViewVC 1.1.30