From 3c1f5f930fd12c5fd6237251d4c7d1118ee64539 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 21 Feb 2011 15:14:47 +0000 Subject: - use a define to allow multiple forum installation ( for numerous locale ) --- modules/phpbb/manifests/init.pp | 125 ++++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 50 deletions(-) (limited to 'modules/phpbb/manifests') diff --git a/modules/phpbb/manifests/init.pp b/modules/phpbb/manifests/init.pp index 9481fbb4..3cba5496 100644 --- a/modules/phpbb/manifests/init.pp +++ b/modules/phpbb/manifests/init.pp @@ -1,69 +1,94 @@ class phpbb { - $database = "phpbb" - $user = "phpbb" + class base { + $db = "phpbb" + $user = "phpbb" - include apache::mod_php - include mysql + include apache::mod_php + include mysql - package { ["php-gd","php-xml","php-zlib","php-ftp","php-magickwand","php-pgsql" ] : - ensure => installed - } + package { ["php-gd","php-xml","php-zlib","php-ftp","php-magickwand","php-pgsql" ] : + ensure => installed + } - package { "perl-DBD-Pg": - ensure => installed - } + package { "perl-DBD-Pg": + ensure => installed + } - file { "/usr/local/bin/phpbb_apply_config.pl": - ensure => present, - owner => root, - group => root, - mode => 755, - source => 'puppet:///modules/phpbb/phpbb_apply_config.pl', - } + file { "/usr/local/bin/phpbb_apply_config.pl": + ensure => present, + owner => root, + group => root, + mode => 755, + source => 'puppet:///modules/phpbb/phpbb_apply_config.pl', + } - # TODO phpbb config - # cookie_domain - # board_contact - # - define phpbb_config($value) { - exec { "/usr/local/bin/phpbb_apply_config.pl $name": - user => root, - environment => ["PGDATABASE=$database", "PGUSER=$user", "PGPASSWORD=$pgsql_password", "PGHOST=pgsql.$domain", "VALUE=$value"], - require => File["/usr/local/bin/phpbb_apply_config.pl"], + # TODO phpbb config + # cookie_domain + # board_contact + # + define phpbb_config($value) { + exec { "/usr/local/bin/phpbb_apply_config.pl $name": + user => root, + environment => ["PGDATABASE=$database", "PGUSER=$user", "PGPASSWORD=$pgsql_password", "PGHOST=pgsql.$domain", "VALUE=$value"], + require => File["/usr/local/bin/phpbb_apply_config.pl"], + } } - } - phpbb_config { "ldap_user": - value => "cn=phpbb-friteuse,ou=System Accounts,$dc_suffix", - } + $pgsql_password = extlookup("phpbb_pgsql",'x') + @@postgresql::user { $user: + password => $pgsql_password, + } - phpbb_config { "ldap_server": - value => "ldap.$domain", + $forums_dir = "/var/www/forums/" + file { "$forums_dir": + ensure => directory, + owner => root, + group => root, + } } - $ldap_password = extlookup("phpbb_ldap",'x') - phpbb_config { "ldap_password": - value => $ldap_password, - } + define php_instance($lang) { + $database = "${db}_$lang" - phpbb_config { "ldap_base_dn": - value => "ou=People,$dc_suffix", - } + include git::client + exec { "git clone git://git.$domain/forum/ $lang": + cwd => $forums_dir, + creates => "$forums_dir/$lang", + } + file { "$forums_dir/$lang/phpBB/config.php": + ensure => present, + owner => root, + group => root, + mode => 644, + content => template("phpbb/config.php"), + } - # TODO git checkout of the code - include git::client + include php::base - # TODO phpbb database configuration - $pgsql_password = extlookup("phpbb_pgsql",'x') - @@postgresql::user { $user: - password => $pgsql_password, - } + @@postgresql::database { $database: + description => "Phpbb database", + user => $user, + require => Postgresql::User[$user] + } + + + phpbb_config { "ldap_user": + value => "cn=phpbb-friteuse,ou=System Accounts,$dc_suffix", + } + + phpbb_config { "ldap_server": + value => "ldap.$domain", + } - @@postgresql::database { $database: - description => "Phpbb database", - user => $user, - require => Postgresql::User[$user] + $ldap_password = extlookup("phpbb_ldap",'x') + phpbb_config { "ldap_password": + value => $ldap_password, + } + + phpbb_config { "ldap_base_dn": + value => "ou=People,$dc_suffix", + } } } -- cgit v1.2.1