aboutsummaryrefslogtreecommitdiffstats
path: root/modules/phpbb/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/phpbb/manifests')
-rw-r--r--modules/phpbb/manifests/base.pp18
-rw-r--r--modules/phpbb/manifests/config.pp14
-rw-r--r--modules/phpbb/manifests/databases.pp3
-rw-r--r--modules/phpbb/manifests/init.pp109
-rw-r--r--modules/phpbb/manifests/instance.pp80
-rw-r--r--modules/phpbb/manifests/locale_db.pp12
-rw-r--r--modules/phpbb/manifests/redirection_instance.pp7
7 files changed, 123 insertions, 120 deletions
diff --git a/modules/phpbb/manifests/base.pp b/modules/phpbb/manifests/base.pp
index 6765fb43..9f676cb4 100644
--- a/modules/phpbb/manifests/base.pp
+++ b/modules/phpbb/manifests/base.pp
@@ -3,13 +3,12 @@ class phpbb::base {
$user = 'phpbb'
$forums_dir = '/var/www/forums/'
- include apache::mod_php
+ include apache::mod::php
package {['php-gd',
'php-xml',
'php-zlib',
'php-ftp',
- 'php-apc',
'php-magickwand',
'php-pgsql',
'php-ldap']: }
@@ -30,14 +29,23 @@ class phpbb::base {
ensure => directory,
}
+ $robotsfile = "$forums_dir/robots.txt"
+ file { $robotsfile:
+ ensure => present,
+ mode => '0644',
+ owner => root,
+ group => root,
+ source => 'puppet:///modules/phpbb/robots.txt',
+ }
+
# TODO check that everything is locked down
- apache::vhost_base { "forums.$::domain":
+ apache::vhost::base { "forums.${::domain}":
content => template('phpbb/forums_vhost.conf'),
}
- apache::vhost_base { "ssl_forums.$::domain":
+ apache::vhost::base { "ssl_forums.${::domain}":
use_ssl => true,
- vhost => "forums.$::domain",
+ vhost => "forums.${::domain}",
content => template('phpbb/forums_vhost.conf'),
}
diff --git a/modules/phpbb/manifests/config.pp b/modules/phpbb/manifests/config.pp
index 52bd5419..553b0f74 100644
--- a/modules/phpbb/manifests/config.pp
+++ b/modules/phpbb/manifests/config.pp
@@ -1,12 +1,12 @@
define phpbb::config($key, $value, $database) {
- exec { "phpbb_apply $name":
- command => "/usr/local/bin/phpbb_apply_config.pl $key",
+ exec { "phpbb_apply ${name}":
+ command => "/usr/local/bin/phpbb_apply_config.pl ${key}",
user => 'root',
- environment => ["PGDATABASE=$database",
- "PGUSER=$phpbb::base::user",
- "PGPASSWORD=$phpbb::base::pgsql_password",
- "PGHOST=pgsql.$::domain",
- "VALUE=$value"],
+ environment => ["PGDATABASE=${database}",
+ "PGUSER=${phpbb::base::user}",
+ "PGPASSWORD=${phpbb::base::pgsql_password}",
+ "PGHOST=pgsql.${::domain}",
+ "VALUE=${value}"],
require => File['/usr/local/bin/phpbb_apply_config.pl'],
}
}
diff --git a/modules/phpbb/manifests/databases.pp b/modules/phpbb/manifests/databases.pp
new file mode 100644
index 00000000..dc255f75
--- /dev/null
+++ b/modules/phpbb/manifests/databases.pp
@@ -0,0 +1,3 @@
+define phpbb::databases() {
+ Phpbb::Locale_db <<| |>>
+}
diff --git a/modules/phpbb/manifests/init.pp b/modules/phpbb/manifests/init.pp
index 90248384..ccfa0ca2 100644
--- a/modules/phpbb/manifests/init.pp
+++ b/modules/phpbb/manifests/init.pp
@@ -1,108 +1 @@
-class phpbb {
- define redirection_instance($url) {
- $lang = $name
- file { "/etc/httpd/conf/vhosts.d/forums.d/redirect_$name.conf":
- content => template("phpbb/forums_redirect.conf"),
- notify => Exec['service httpd configtest'],
- }
- }
-
- define databases(){
- Phpbb::Locale_db <<| |>>
- }
-
- define locale_db($tag = "default",
- $user = $phpbb::base::user) {
- postgresql::database { $name:
- description => "$lang db for phpbb forum",
- user => $user,
- tag => $tag,
- # this break due to the way it is remotely declared
- # this should only be a issue in case of bootstrapping again
- # require => Postgresql::User[$user]
- }
- }
-
- # TODO find a way to avoid all the phpbb::base prefix
- define instance() {
- include phpbb::base
-
- $lang = $name
- $database = "${phpbb::base::db}_$lang"
-
- $user = $phpbb::base::user
- $pgsql_password = $phpbb::base::pgsql_password
- $forums_dir = $phpbb::base::forums_dir
-
- include git::client
- exec { "git_clone $lang":
- command =>"git clone git://git.$domain/forum/ $lang",
- cwd => $forums_dir,
- creates => "$forums_dir/$lang",
- require => File["$forums_dir"],
- notify => Exec["rm_install $lang"],
- }
-
- # remove this or the forum will not work ( 'board disabled' )
- # maybe it would be better to move this elsehwere, I
- # am not sure ( and in any case, that's still in git )
- exec { "rm_install $lang":
- command => "rm -Rf $forums_dir/$lang/phpBB/install",
- onlyif => "test -d $forums_dir/$lang/phpBB/install",
- }
-
- # list found by reading ./install/install_install.php
- # end of check_server_requirements ( 2 loops )
-
- $writable_dirs = ['cache',
- 'images/avatars/upload',
- 'files',
- 'store' ]
-
- $dir_names = regsubst($writable_dirs,'^',"$forums_dir/$lang/phpBB/")
-
- file { $dir_names:
- ensure => directory,
- owner => apache,
- require => Exec["git_clone $lang"],
- }
-
- file { "$forums_dir/$lang/phpBB/config.php":
- content => template("phpbb/config.php"),
- }
-
- @@phpbb::locale_db { $database:
- user => $user,
- }
-
- Phpbb::Config {
- database => $database,
- }
-
- $ldap_password = extlookup("phpbb_ldap",'x')
-
- phpbb::config {
- "ldap_user/$lang":
- key => "ldap_user", value => "cn=phpbb-$hostname,ou=System Accounts,$dc_suffix";
- "ldap_server/$lang":
- key => "ldap_server", value => "ldaps://ldap.$domain ldaps://ldap-slave-1.$domain";
- "ldap_password/$lang":
- key => "ldap_password", value => $ldap_password;
- "ldap_base_dn/$lang":
- key => "ldap_base_dn", value => "ou=People,$dc_suffix";
- "auth_method/$lang":
- key => "auth_method", value => "ldap";
- "ldap_mail/$lang":
- key => "ldap_mail", value => "mail";
- "ldap_uid/$lang":
- key => "ldap_uid", value => "uid";
- "cookie_domain/$lang":
- key => "cookie_domain", value => "forums.$domain";
- "server_name/$lang":
- key => "server_name", value => "forums.$domain";
- "default_lang/$lang":
- key => "default_lang", value => $lang;
- }
-
- }
-}
+class phpbb { }
diff --git a/modules/phpbb/manifests/instance.pp b/modules/phpbb/manifests/instance.pp
new file mode 100644
index 00000000..e300d9e0
--- /dev/null
+++ b/modules/phpbb/manifests/instance.pp
@@ -0,0 +1,80 @@
+define phpbb::instance() {
+ include phpbb::base
+
+ $lang = $name
+ $database = "${phpbb::base::db}_${lang}"
+
+ $user = $phpbb::base::user
+ $pgsql_password = $phpbb::base::pgsql_password
+ $forums_dir = $phpbb::base::forums_dir
+
+ include git::client
+ exec { "git_clone ${lang}":
+ command =>"git clone git://git.${::domain}/web/forums/ ${lang}",
+ cwd => $forums_dir,
+ creates => "${forums_dir}/${lang}",
+ require => File[$forums_dir],
+ notify => Exec["rm_install ${lang}"],
+ }
+
+ # remove this or the forum will not work ( 'board disabled' )
+ # maybe it would be better to move this elsewhere, I
+ # am not sure ( and in any case, that's still in git )
+ exec { "rm_install ${lang}":
+ command => "rm -Rf ${forums_dir}/${lang}/phpBB/install",
+ onlyif => "test -d ${forums_dir}/${lang}/phpBB/install",
+ }
+
+ # list found by reading ./install/install_install.php
+ # end of check_server_requirements ( 2 loops )
+
+ $writable_dirs = ['cache',
+ 'images/avatars/upload',
+ 'files',
+ 'store' ]
+
+ $dir_names = regsubst($writable_dirs,'^',"${forums_dir}/${lang}/phpBB/")
+
+ file { $dir_names:
+ ensure => directory,
+ owner => 'apache',
+ require => Exec["git_clone ${lang}"],
+ }
+
+ file { "${forums_dir}/${lang}/phpBB/config.php":
+ content => template('phpbb/config.php'),
+ }
+
+ @@phpbb::locale_db { $database:
+ user => $user,
+ }
+
+ Phpbb::Config {
+ database => $database,
+ }
+
+ $ldap_password = extlookup( 'phpbb_ldap','x')
+
+ phpbb::config {
+ "ldap_user/${lang}":
+ key => 'ldap_user', value => "cn=phpbb-${::hostname},ou=System Accounts,${::dc_suffix}";
+ "ldap_server/${lang}":
+ key => 'ldap_server', value => "ldaps://ldap.${::domain} ldaps://ldap-slave-1.${::domain}";
+ "ldap_password/${lang}":
+ key => 'ldap_password', value => $ldap_password;
+ "ldap_base_dn/${lang}":
+ key => 'ldap_base_dn', value => "ou=People,${::dc_suffix}";
+ "auth_method/${lang}":
+ key => 'auth_method', value => 'ldap';
+ "ldap_mail/${lang}":
+ key => 'ldap_mail', value => 'mail';
+ "ldap_uid/${lang}":
+ key => 'ldap_uid', value => 'uid';
+ "cookie_domain/${lang}":
+ key => 'cookie_domain', value => "forums.${::domain}";
+ "server_name/${lang}":
+ key => 'server_name', value => "forums.${::domain}";
+ "default_lang/${lang}":
+ key => 'default_lang', value => $lang;
+ }
+}
diff --git a/modules/phpbb/manifests/locale_db.pp b/modules/phpbb/manifests/locale_db.pp
new file mode 100644
index 00000000..70116962
--- /dev/null
+++ b/modules/phpbb/manifests/locale_db.pp
@@ -0,0 +1,12 @@
+# FIXME: In puppet >3.0 word 'tag' is reserved, so it have to be renamed
+define phpbb::locale_db($tag = 'default',
+ $user = $phpbb::base::user) {
+ postgresql::database { $name:
+ description => "${lang} db for phpbb forum",
+ user => $user,
+ tag => $tag,
+# this break due to the way it is remotely declared
+# this should only be a issue in case of bootstrapping again
+# require => Postgresql::User[$user]
+ }
+}
diff --git a/modules/phpbb/manifests/redirection_instance.pp b/modules/phpbb/manifests/redirection_instance.pp
new file mode 100644
index 00000000..332eac53
--- /dev/null
+++ b/modules/phpbb/manifests/redirection_instance.pp
@@ -0,0 +1,7 @@
+define phpbb::redirection_instance($url) {
+ $lang = $name
+ file { "/etc/httpd/conf/vhosts.d/forums.d/redirect_${name}.conf":
+ content => template('phpbb/forums_redirect.conf'),
+ notify => Exec['apachectl configtest'],
+ }
+}