aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2011-02-15 00:48:24 +0000
committerMichael Scherer <misc@mageia.org>2011-02-15 00:48:24 +0000
commitb8481f2561b8de21892e3f4b1914193d54ac4c93 (patch)
tree243999b9f406e1a89fd7b7e76b66d18fb9e93e1c /modules
parent116df2e39ac697b55b11021985555b8f889d5110 (diff)
downloadpuppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar
puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar.gz
puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar.bz2
puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar.xz
puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.zip
add a define to manage part of the phpbb config from puppet by directly changing the configuration in the db
Diffstat (limited to 'modules')
-rw-r--r--modules/phpbb/files/phpbb_apply_config.pl22
-rw-r--r--modules/phpbb/manifests/init.pp22
2 files changed, 43 insertions, 1 deletions
diff --git a/modules/phpbb/files/phpbb_apply_config.pl b/modules/phpbb/files/phpbb_apply_config.pl
new file mode 100644
index 00000000..fd0282d1
--- /dev/null
+++ b/modules/phpbb/files/phpbb_apply_config.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Env qw(VALUE);
+use DBI;
+
+# DBI will use default value coming from env
+# see puppet manifests
+my $key = $ARGV[1];
+
+my $dbh = DBI->connect("dbi:Pg:","","");
+
+my $table = "phpbb_config";
+
+my $update = $dbh->prepare("UPDATE $table SET config_value = ? WHERE config_name = ?");
+my $insert = $dbh->prepare("INSERT INTO $table ( config_value, config_name, is_dynamic ) VALUES ( ? , ? , ? )");
+
+my $res = $update->execute($VALUE ,$key) or die "cannot do update $?";
+if ($res == 0 ) {
+ $insert->execute($VALUE ,$key, 1) or die "cannot do insert $?";
+}
+
diff --git a/modules/phpbb/manifests/init.pp b/modules/phpbb/manifests/init.pp
index 533a4304..1d4bfbe5 100644
--- a/modules/phpbb/manifests/init.pp
+++ b/modules/phpbb/manifests/init.pp
@@ -11,7 +11,27 @@ class phpbb {
# TODO ldap account configuration
- # TODO apache setup
+ 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 ldap account configuration
+ # ldap_user
+ # ldap_server
+ # ldap_password ldap_base_dn 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=$password PGHOST=pgsql.$domain VALUE=$value",
+ require => File["/usr/local/bin/phpbb_apply_config.pl"],
+ }
+ }
# TODO git checkout