finish handle support in dev VM
authorymh <ymh.work@gmail.com>
Tue, 12 Apr 2016 13:05:43 +0200
changeset 150 cb4c47eda2db
parent 149 3ace15523e6b
child 151 95dfb40ff3d2
finish handle support in dev VM
dev/provisioning/custom.yaml.tmpl
dev/provisioning/default.pp
dev/provisioning/modules/sysconfig/files/handle/handle_data.sql
dev/provisioning/modules/sysconfig/files/handle/handle_data_2.sql
dev/provisioning/modules/sysconfig/files/handle/handle_data_3.sql
dev/provisioning/modules/sysconfig/files/handle/handle_data_4.sql
dev/provisioning/modules/sysconfig/files/handle/handle_script_corpus_admin_keys.exp
dev/provisioning/modules/sysconfig/manifests/handle.pp
dev/provisioning/modules/sysconfig/manifests/params.pp
dev/provisioning/modules/sysconfig/manifests/sesame.pp
dev/provisioning/modules/sysconfig/templates/handle/handle_data.sql.sh.erb
--- a/dev/provisioning/custom.yaml.tmpl	Fri Apr 08 19:30:17 2016 +0200
+++ b/dev/provisioning/custom.yaml.tmpl	Tue Apr 12 13:05:43 2016 +0200
@@ -1,4 +1,7 @@
 ---
+# install handle
+sysconfig::params::install_handle : true
+
 # Serveur hostname (ex: the first ip of the server : %{ipaddress_eth0})
 sysconfig::params::vhost : "int.corpusdelaparole.huma-num.fr"
 
--- a/dev/provisioning/default.pp	Fri Apr 08 19:30:17 2016 +0200
+++ b/dev/provisioning/default.pp	Tue Apr 12 13:05:43 2016 +0200
@@ -7,7 +7,7 @@
 class { 'sysconfig::sys_upgrade': }->
 
 # install mariadb
-class { 'sysconfig::mariadb': }->
+class { 'sysconfig::mariadb': }
 
 # install packages
 class { 'sysconfig::packages': }->
@@ -19,7 +19,9 @@
 class { 'sysconfig::php': }
 
 # install handle
-class { 'sysconfig::handle': }
+if(hiera('sysconfig::params::install_handle', true)) {
+    class { 'sysconfig::handle': }
+}
 
 # install tomcat
 class { 'sysconfig::tomcat': }
--- a/dev/provisioning/modules/sysconfig/files/handle/handle_data.sql	Fri Apr 08 19:30:17 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
--- MySQL dump 10.16  Distrib 10.1.13-MariaDB, for osx10.11 (x86_64)
---
--- Host: 172.16.1.6    Database: handle
--- ------------------------------------------------------
--- Server version	5.5.44-MariaDB
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Dumping data for table `handles`
---
-
-LOCK TABLES `handles` WRITE;
-/*!40000 ALTER TABLE `handles` DISABLE KEYS */;
-INSERT INTO `handles` VALUES ('12345/ADMIN',300,'HS_SECKEY','admin',0,86400,1459508158,'',1,1,0,0);
-/*!40000 ALTER TABLE `handles` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `nas`
---
-
-LOCK TABLES `nas` WRITE;
-/*!40000 ALTER TABLE `nas` DISABLE KEYS */;
-INSERT INTO `nas` VALUES ('0.NA/12345');
-/*!40000 ALTER TABLE `nas` ENABLE KEYS */;
-UNLOCK TABLES;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2016-04-02  2:15:04
--- a/dev/provisioning/modules/sysconfig/files/handle/handle_data_2.sql	Fri Apr 08 19:30:17 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
--- MySQL dump 10.16  Distrib 10.1.13-MariaDB, for osx10.11 (x86_64)
---
--- Host: 172.16.1.6    Database: handle
--- ------------------------------------------------------
--- Server version	5.5.44-MariaDB
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Dumping data for table `handles`
---
-
-LOCK TABLES `handles` WRITE;
-/*!40000 ALTER TABLE `handles` DISABLE KEYS */;
-INSERT INTO `handles` VALUES ('12345/ADMIN',200,0x48535F564C495354,0x3330303A31302E35302F555352313B203330303A31302E35302F555352323B,0,86400,1460065541,'',1,1,1,0),('12345/ADMIN',300,0x48535F5055424B4559,0x0000000B5253415F5055425F4B455900000000000301000100000101009B894C2F4E7E0F7FB8F6897DFFCEBD31A94C0D70EBF23A05D25559782148F67066E28F9B1D16338C1A38ACEF6A315BC08AEB3768941F5CA8E358C5A89CD6EBFCF14BC7AAA04CF3D897FF942CEED365891E486A3D65CDBE1F72208DABD8A86C8D17FC4CA5F4309FD4AE2C861A8A5F74941362DDCE71D85BF6E967BB16D6B102A5AB49AD33559B383126CF98332A688718722D84680569948FC8EEEC520C5F02067F14FD67889113CB72275179B40DA8557E61BEC05EFDBFE2801B6212DB6262F370A17F48CA6CA5A0C8F369BB4478B30EA9C9E1FC0A735AA2A4720DFC2D97025A882BDD6C538508DFC18EE4F5767F9C103C33D0795DADB673F290942F198E3EF500000000,0,86400,1460065541,'',1,1,1,0),('12345/ADMIN',301,0x48535F5345434B4559,0x61646D696E,0,86400,1460065541,'',1,1,0,0);
-/*!40000 ALTER TABLE `handles` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `nas`
---
-
-LOCK TABLES `nas` WRITE;
-/*!40000 ALTER TABLE `nas` DISABLE KEYS */;
-INSERT INTO `nas` VALUES ('0.NA/12345');
-/*!40000 ALTER TABLE `nas` ENABLE KEYS */;
-UNLOCK TABLES;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2016-04-08  9:37:17
--- a/dev/provisioning/modules/sysconfig/files/handle/handle_data_3.sql	Fri Apr 08 19:30:17 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
--- MySQL dump 10.16  Distrib 10.1.13-MariaDB, for osx10.11 (x86_64)
---
--- Host: 172.16.1.6    Database: handle
--- ------------------------------------------------------
--- Server version	5.5.44-MariaDB
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Dumping data for table `handles`
---
-
-LOCK TABLES `handles` WRITE;
-/*!40000 ALTER TABLE `handles` DISABLE KEYS */;
-INSERT INTO `handles` VALUES ('12345/ADMIN',200,'HS_VLIST','300:10.50/USR1; 300:10.50/USR2;',0,86400,1460065541,'',1,1,1,0);
-INSERT INTO `handles` VALUES ('12345/ADMIN',300,'HS_PUBKEY','\0\0\0RSA_PUB_KEY\0\0\0\0\0\0\0\0\0L/N~}ν1L\rp:UYx!Hpf⏛3\Z8j1[7h\\XŨKǪLؗ,eHj=e;r بlL0Ԯ,\Z_tbq[gֱI3U81&Ϙ3*hr-hiR_gr\'Qy\rU~a^bbbpHliDx\nsZr\r-Z+lSv<3y]s/>\0\0\0\0',0,86400,1460065541,'',1,1,1,0);
-INSERT INTO `handles` VALUES ('12345/ADMIN',301,'HS_SECKEY','admin',0,86400,1460065541,'',1,1,0,0);
-/*!40000 ALTER TABLE `handles` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `nas`
---
-
-LOCK TABLES `nas` WRITE;
-/*!40000 ALTER TABLE `nas` DISABLE KEYS */;
-INSERT INTO `nas` VALUES ('0.NA/12345');
-/*!40000 ALTER TABLE `nas` ENABLE KEYS */;
-UNLOCK TABLES;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2016-04-08  9:43:09
--- a/dev/provisioning/modules/sysconfig/files/handle/handle_data_4.sql	Fri Apr 08 19:30:17 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
--- MySQL dump 10.16  Distrib 10.1.13-MariaDB, for osx10.11 (x86_64)
---
--- Host: 172.16.1.6    Database: handle
--- ------------------------------------------------------
--- Server version	5.5.44-MariaDB
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Dumping data for table `handles`
---
-
-LOCK TABLES `handles` WRITE;
-/*!40000 ALTER TABLE `handles` DISABLE KEYS */;
-INSERT INTO `handles` VALUES ('12345/ADMIN',200,0x48535F564C495354,0x3330303A31302E35302F555352313B203330303A31302E35302F555352323B,0,86400,1460065541,'',1,1,1,0);
-INSERT INTO `handles` VALUES ('12345/ADMIN',300,0x48535F5055424B4559,0x0000000B5253415F5055425F4B455900000000000301000100000101009B894C2F4E7E0F7FB8F6897DFFCEBD31A94C0D70EBF23A05D25559782148F67066E28F9B1D16338C1A38ACEF6A315BC08AEB3768941F5CA8E358C5A89CD6EBFCF14BC7AAA04CF3D897FF942CEED365891E486A3D65CDBE1F72208DABD8A86C8D17FC4CA5F4309FD4AE2C861A8A5F74941362DDCE71D85BF6E967BB16D6B102A5AB49AD33559B383126CF98332A688718722D84680569948FC8EEEC520C5F02067F14FD67889113CB72275179B40DA8557E61BEC05EFDBFE2801B6212DB6262F370A17F48CA6CA5A0C8F369BB4478B30EA9C9E1FC0A735AA2A4720DFC2D97025A882BDD6C538508DFC18EE4F5767F9C103C33D0795DADB673F290942F198E3EF500000000,0,86400,1460065541,'',1,1,1,0);
-INSERT INTO `handles` VALUES ('12345/ADMIN',301,0x48535F5345434B4559,0x61646D696E,0,86400,1460065541,'',1,1,0,0);
-/*!40000 ALTER TABLE `handles` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `nas`
---
-
-LOCK TABLES `nas` WRITE;
-/*!40000 ALTER TABLE `nas` DISABLE KEYS */;
-INSERT INTO `nas` VALUES ('0.NA/12345');
-/*!40000 ALTER TABLE `nas` ENABLE KEYS */;
-UNLOCK TABLES;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2016-04-08  9:44:14
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/sysconfig/files/handle/handle_script_corpus_admin_keys.exp	Tue Apr 12 13:05:43 2016 +0200
@@ -0,0 +1,53 @@
+#!/bin/expect -f
+#
+# This Expect script was generated by autoexpect on Wed Mar 23 13:16:38 2016
+# Expect and autoexpect were both written by Don Libes, NIST.
+#
+# Note that autoexpect does not guarantee a working script.  It
+# necessarily has to guess about certain things.  Two reasons a script
+# might fail are:
+#
+# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
+# etc.) and devices discard or ignore keystrokes that arrive "too
+# quickly" after prompts.  If you find your new script hanging up at
+# one spot, try adding a short sleep just before the previous send.
+# Setting "force_conservative" to 1 (see below) makes Expect do this
+# automatically - pausing briefly before sending each character.  This
+# pacifies every program I know of.  The -c flag makes the script do
+# this in the first place.  The -C flag allows you to define a
+# character to toggle this mode off and on.
+# exp_internal 1
+set force_conservative 0  ;# set to 1 to force conservative mode even if
+                          ;# script wasn't run conservatively originally
+if {$force_conservative} {
+        set send_slow {1 .1}
+        proc send {ignore arg} {
+                sleep .1
+                exp_send -s -- $arg
+        }
+}
+
+#
+# 2) differing output - Some programs produce different output each time
+# they run.  The "date" command is an obvious example.  Another is
+# ftp, if it produces throughput statistics at the end of a file
+# transfer.  If this causes a problem, delete these patterns or replace
+# them with wildcards.  An alternative is to use the -p flag (for
+# "prompt") which makes Expect only look for the last line of output
+# (i.e., the prompt).  The -P flag allows you to define a character to
+# toggle this mode off and on.
+#
+# Read the man page for more info.
+#
+# -Don
+
+
+set timeout -1
+spawn /opt/handle/bin/hdl-keygen /var/lib/handle/corpusadmpriv.bin /var/lib/handle/corpusadmpub.bin
+match_max 5000
+
+
+expect -re "Would you like to encrypt your private key\\\? \\\(y\\\/n\\\) \\\[y\\\] $"
+send -- "n\r"
+
+expect eof
--- a/dev/provisioning/modules/sysconfig/manifests/handle.pp	Fri Apr 08 19:30:17 2016 +0200
+++ b/dev/provisioning/modules/sysconfig/manifests/handle.pp	Tue Apr 12 13:05:43 2016 +0200
@@ -1,14 +1,15 @@
 class sysconfig::handle (
-    $hdl_host     = hiera('sysconfig::params::hdl_host', $sysconfig::params::hdl_host),
-    $hdl_user     = hiera('sysconfig::params::hdl_user', $sysconfig::params::hdl_user),
-    $hdl_srv_port = hiera('sysconfig::params::hdl_srv_port', $sysconfig::params::hdl_srv_port),
-    $hdl_web_port = hiera('sysconfig::params::hdl_web_port', $sysconfig::params::hdl_web_port),
-    $hdl_key_pswd = hiera('sysconfig::params::hdl_key_pswd', $sysconfig::params::hdl_key_pswd),
-    $hdl_prefix   = hiera('sysconfig::params::hdl_prefix', $sysconfig::params::hdl_prefix),
-    $hdl_db_name  = hiera('sysconfig::params::hdl_db_name', $sysconfig::params::hdl_db_name),
-    $db_user      = hiera('sysconfig::params::db_user',      $sysconfig::params::db_user),
-    $db_pw        = hiera('sysconfig::params::db_pw',        $sysconfig::params::db_pw),
-    $db_host      = hiera('sysconfig::params::db_host',      $sysconfig::params::db_host)
+    $hdl_host           = hiera('sysconfig::params::hdl_host', $sysconfig::params::hdl_host),
+    $hdl_user           = hiera('sysconfig::params::hdl_user', $sysconfig::params::hdl_user),
+    $hdl_srv_port       = hiera('sysconfig::params::hdl_srv_port', $sysconfig::params::hdl_srv_port),
+    $hdl_web_port       = hiera('sysconfig::params::hdl_web_port', $sysconfig::params::hdl_web_port),
+    $hdl_key_pswd       = hiera('sysconfig::params::hdl_key_pswd', $sysconfig::params::hdl_key_pswd),
+    $hdl_prefix         = hiera('sysconfig::params::hdl_prefix', $sysconfig::params::hdl_prefix),
+    $hdl_prefix_admin   = hiera('sysconfig::params::hdl_prefix_admin', $sysconfig::params::hdl_prefix_admin),
+    $hdl_db_name        = hiera('sysconfig::params::hdl_db_name', $sysconfig::params::hdl_db_name),
+    $db_user            = hiera('sysconfig::params::db_user', $sysconfig::params::db_user),
+    $db_pw              = hiera('sysconfig::params::db_pw', $sysconfig::params::db_pw),
+    $db_host            = hiera('sysconfig::params::db_host', $sysconfig::params::db_host)
 ) inherits sysconfig::params {
 
     # iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 1080
@@ -17,8 +18,7 @@
 
     $handle_dirs = [
         "/opt/handle",
-        "/opt/handle/sbin",
-        "/tmp/handle"
+        "/opt/handle/sbin"
     ]
 
     group { "$hdl_user":
@@ -41,6 +41,11 @@
     file { $handle_dirs:
         ensure => directory,
     }->
+    file { "/tmp/handle":
+        ensure => directory,
+        owner => "$hdl_user",
+        group => "$hdl_user"
+    }->
     archive { 'handle-8.1':
         ensure => present,
         url => "http://www.handle.net/hnr-source/hsj-8.1.0.tar.gz",
@@ -62,24 +67,6 @@
         source => "puppet:///modules/sysconfig/handle/mysql-connector-java-5.1.38-bin.jar",
         mode => "0644"
     }->
-    file { '/tmp/handle/handle_db.sql':
-        ensure => file,
-        source => "puppet:///modules/sysconfig/handle/handle_db.sql",
-        owner => "$hdl_user",
-        group => "$hdl_user",
-        mode => "0750"
-    }->
-    mysql::db { "handle_db":
-        dbname => $hdl_db_name,
-        user => $db_user,
-        password => $db_pw,
-        host => $db_host,
-        sql => '/tmp/handle/handle_db.sql',
-        charset => 'utf8',
-        collate => 'utf8_general_ci',
-        notify => Exec['rm-tmp-handle-db'],
-        require => Service["mariadb"],
-    }->
     file { "/tmp/handle/handle_init_script.exp":
         ensure => file,
         content => template("sysconfig/handle/handle_script.exp.erb"),
@@ -102,81 +89,81 @@
         group => "$hdl_user",
         content => template("sysconfig/handle/handle_config.dct.erb"),
         replace => true
+    }
+
+    # create handle admin handle keys
+    file { "/tmp/handle/handle_script_corpus_admin_keys.exp":
+        ensure => file,
+        source => "puppet:///modules/sysconfig/handle/handle_script_corpus_admin_keys.exp",
+        owner => "$hdl_user",
+        group => "$hdl_user",
+        mode => "0750"
     }->
+    exec { "init-handle-corpus-admin-keys":
+        command => "/tmp/handle/handle_script_corpus_admin_keys.exp",
+        cwd => "/opt/handle/bin",
+        provider => 'shell',
+        creates => "/var/lib/handle/corpusadmpriv.bin",
+        user => $hdl_user,
+        notify => Exec['rm-tmp-handle-corpus-admin-key'],
+        require => [Archive["handle-8.1"], Package['java-install'], Package['expect']]
+    }
+
+    file { '/tmp/handle/handle_data.sql.sh':
+        ensure => file,
+        content => template("sysconfig/handle/handle_data.sql.sh.erb"),
+        owner => "$hdl_user",
+        group => "$hdl_user",
+        mode => "0750"
+    }
+
+    exec { "init_handle_db_data":
+        command => "/tmp/handle/handle_data.sql.sh",
+        creates => "/tmp/handle/handle_data.sql",
+        user => $hdl_user,
+        require => [File['/tmp/handle/handle_data.sql.sh'], Exec['init-handle-corpus-admin-keys']]
+    }
+
+    file { '/tmp/handle/handle_db.sql':
+        ensure => file,
+        source => "puppet:///modules/sysconfig/handle/handle_db.sql",
+        owner => "$hdl_user",
+        group => "$hdl_user",
+        mode => "0750"
+    }
+
+    mysql::db { "handle_db":
+        dbname => $hdl_db_name,
+        user => $db_user,
+        password => $db_pw,
+        host => $db_host,
+        sql => ['/tmp/handle/handle_db.sql', '/tmp/handle/handle_data.sql'],
+        charset => 'utf8',
+        collate => 'utf8_general_ci',
+        notify => [Exec['rm-tmp-handle-db'], Exec['rm-tmp-handle-data']],
+        require => [Service["mariadb"], File['/tmp/handle/handle_db.sql'], Exec['init_handle_db_data']],
+    }
+
     exec { "handle-first-start":
         command => "/usr/bin/echo \"${HANDLE_KEY_PSWD}\" | /opt/handle/bin/hdl-server /var/lib/handle &",
         provider => 'shell',
         creates => "/var/lib/handle/.handle_initialized",
         user => $hdl_user,
-        require => File['/etc/sysconfig/handle']
+        require => [File['/etc/sysconfig/handle'], File['/var/lib/handle/config.dct'], Mysql::Db['handle_db']]
     }->
     exec { "handle-first-stop":
         command => "/usr/bin/sleep 10 && rm -f /var/lib/handle/delete_this_to_stop_server && touch /var/lib/handle/.handle_initialized",
         provider => 'shell',
         creates => "/var/lib/handle/.handle_initialized",
-        user => $hdl_user,
-        require => File['/etc/sysconfig/handle']
+        user => $hdl_user
     }->
     file_line { "handle-detached-prefix":
         path => "/var/lib/handle/config.dct",
         match => "\s*\"300:0.NA/$hdl_prefix\"",
-        line => "      \"300:$hdl_prefix/ADMIN\"",
+        line => "      \"300:$hdl_prefix/$hdl_prefix_admin\"",
         multiple => true,
     }
 
-    # file { "/tmp/handle/handle_answers.txt":
-    #     ensure => file,
-    #     content => template("sysconfig/handle/handle_answers.tmp.erb"),
-    # }#->
-    # exec { "init-handle":
-    #     command => "/opt/handle/bin/hdl-setup-server /var/lib/handle < /tmp/handle/handle_answers.txt",
-    #     cwd => "/opt/handle/bin",
-    #     provider => 'shell',
-    #     creates => "/var/lib/handle/sitebndl.zip",
-    #     user => $hdl_user,
-    #     notify => Exec['rm-tmp-handle'],
-    #     require => Package['java-install']
-    # }->
-    # file { "/var/lib/handle/config.dct":
-    #     ensure => file,
-    #     owner => "$hdl_user",
-    #     group => "$hdl_user",
-    #     content => template("sysconfig/handle/handle_config.dct.erb"),
-    #     replace => true
-    # }->
-    # exec { "open-handle-web-port":
-    #     command => "firewall-cmd --permanent --add-port=8000/tcp",
-    #     path => [ '/bin', '/usr/bin', '/usr/local/bin' ]
-    # }->
-    # exec { "open-handle-srv-port":
-    #     command => "firewall-cmd --permanent --add-port=2641/tcp",
-    #     path => [ '/bin', '/usr/bin', '/usr/local/bin' ]
-    # }->
-    # exec { "open-handle-port-reload":
-    #     command => "firewall-cmd --reload",
-    #     path => [ '/bin', '/usr/bin', '/usr/local/bin' ]
-    # }->
-    # exec { "handle-first-start":
-    #     command => "/usr/bin/echo \"${HANDLE_KEY_PSWD}\" | /opt/handle/bin/hdl-server /var/lib/handle &",
-    #     provider => 'shell',
-    #     creates => "/var/lib/handle/.handle_initialized",
-    #     user => $hdl_user,
-    #     require => File['/etc/sysconfig/handle']
-    # }->
-    # exec { "handle-first-stop":
-    #     command => "/usr/bin/sleep 10 && rm -f /var/lib/handle/delete_this_to_stop_server && touch /var/lib/handle/.handle_initialized",
-    #     provider => 'shell',
-    #     creates => "/var/lib/handle/.handle_initialized",
-    #     user => $hdl_user,
-    #     require => File['/etc/sysconfig/handle']
-    # }#->
-    # file_line { "handle-detached-prefix":
-    #     path => "/var/lib/handle/config.dct",
-    #     match => "\s*\"300:0.NA/$hdl_prefix\"",
-    #     line => "      \"300:$hdl_prefix/ADMIN\"",
-    #     multiple => true,
-    # }
-
 
     file { "/etc/sysconfig/handle":
         ensure => file,
@@ -201,18 +188,23 @@
         unless => "/usr/bin/systemctl is-enabled handle.service"
     }
 
-    # exec { "rm-tmp-handle":
-    #     command => "/usr/bin/rm /tmp/handle/handle_answers.txt",
-    #     refreshonly => true
-    # }
-
     exec { "rm-tmp-handle":
-        command => "/usr/bin/rm /tmp/handle/handle_init_script.exp",
+        command => "/usr/bin/rm -f /tmp/handle/handle_init_script.exp",
         refreshonly => true
     }
 
     exec { "rm-tmp-handle-db":
-        command => "/usr/bin/rm /tmp/handle/handle_db.sql",
+        command => "/usr/bin/rm -f /tmp/handle/handle_db.sql",
+        refreshonly => true
+    }
+
+    exec { "rm-tmp-handle-data":
+        command => "/usr/bin/rm -f /tmp/handle/handle_data.sql.sh /tmp/handle/handle_data.sql",
+        refreshonly => true
+    }
+
+    exec { "rm-tmp-handle-corpus-admin-key":
+        command => "/usr/bin/rm -f /tmp/handle/handle_script_corpus_admin_keys.exp",
         refreshonly => true
     }
 
--- a/dev/provisioning/modules/sysconfig/manifests/params.pp	Fri Apr 08 19:30:17 2016 +0200
+++ b/dev/provisioning/modules/sysconfig/manifests/params.pp	Tue Apr 12 13:05:43 2016 +0200
@@ -11,13 +11,14 @@
     $es_port     = hiera('sysconfig::params::es_port', '9200')
     $es_instance = hiera('sysconfig::params::es_instance', 'es_01')
 
-    $hdl_host     = hiera('sysconfig::params::hdl_host', $::ipaddress)
-    $hdl_user     = hiera('sysconfig::params::hdl_user', 'handle')
-    $hdl_srv_port = hiera('sysconfig::params::hdl_srv_port', '2641')
-    $hdl_web_port = hiera('sysconfig::params::hdl_web_port', '8000')
-    $hdl_key_pswd = hiera('sysconfig::params::hdl_key_pswd', 'corpus')
-    $hdl_prefix   = hiera('sysconfig::params::hdl_prefix', '12345')
-    $hdl_db_name  = hiera('sysconfig::params::hdl_db_name', 'handle')
+    $hdl_host           = hiera('sysconfig::params::hdl_host', $::ipaddress)
+    $hdl_user           = hiera('sysconfig::params::hdl_user', 'handle')
+    $hdl_srv_port       = hiera('sysconfig::params::hdl_srv_port', '2641')
+    $hdl_web_port       = hiera('sysconfig::params::hdl_web_port', '8000')
+    $hdl_key_pswd       = hiera('sysconfig::params::hdl_key_pswd', 'corpus')
+    $hdl_prefix         = hiera('sysconfig::params::hdl_prefix', '12345')
+    $hdl_prefix_admin   = hiera('sysconfig::params::hdl_prefix_admin', 'CORPUS_ADMIN')
+    $hdl_db_name        = hiera('sysconfig::params::hdl_db_name', 'handle')
 
     $tomcat_open_port = hiera('sysconfig::params::tomcat_open_port', false)
 
--- a/dev/provisioning/modules/sysconfig/manifests/sesame.pp	Fri Apr 08 19:30:17 2016 +0200
+++ b/dev/provisioning/modules/sysconfig/manifests/sesame.pp	Tue Apr 12 13:05:43 2016 +0200
@@ -46,9 +46,9 @@
     file { "/opt/sesame":
         ensure => directory,
     }->
-    archive { 'openrdf-sesame-4':
+    archive { 'openrdf-sesame-4.1.1':
         ensure => present,
-        url => "http://sourceforge.net/projects/sesame/files/Sesame%204/4.0.1/openrdf-sesame-4.0.1-sdk.tar.gz/download",
+        url => "http://downloads.sourceforge.net/project/sesame/Sesame%204/4.1.1/openrdf-sesame-4.1.1-sdk.tar.gz",
         checksum => false,
         follow_redirects => true,
         strip_components => 1,
@@ -70,6 +70,11 @@
         ],
         notify => Service['tomcat']
     }->
+    exec { "undeploy-sesame-tomcat":
+         command => "/usr/bin/rm -f /var/lib/tomcat/webapps/openrdf-*.war && /bin/sleep 10",
+         notify => Service['tomcat'],
+         path => "/usr/bin:/bin"
+    }->
     exec { "copy-sesame-tomcat":
          command => "/usr/bin/cp /opt/sesame/war/*.war /var/lib/tomcat/webapps",
          notify => Service['tomcat']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/sysconfig/templates/handle/handle_data.sql.sh.erb	Tue Apr 12 13:05:43 2016 +0200
@@ -0,0 +1,53 @@
+#!/usr/bin/env sh
+
+handle_admin_pubkey=$(hexdump -ve '1/1 "%.2x"' /var/lib/handle/corpusadmpub.bin);
+
+cat <<EOF > /tmp/handle/handle_data.sql
+-- MySQL dump 10.16  Distrib 10.1.13-MariaDB, for osx10.11 (x86_64)
+--
+-- Host: 172.16.1.6    Database: handle
+-- ------------------------------------------------------
+-- Server version    5.5.44-MariaDB
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Dumping data for table \`handles\`
+--
+
+LOCK TABLES \`handles\` WRITE;
+/*!40000 ALTER TABLE \`handles\` DISABLE KEYS */;
+INSERT INTO \`handles\` VALUES ('<%= @hdl_prefix %>/<%= @hdl_prefix_admin %>',200,'HS_VLIST','300:0.NA/<%= @hdl_prefix %>; 300:<%= @hdl_prefix %>/<%= @hdl_prefix_admin %>;',0,86400,<%= scope.function_time([]) %>,'',1,1,1,0);
+INSERT INTO \`handles\` VALUES ('<%= @hdl_prefix %>/<%= @hdl_prefix_admin %>',300,'HS_PUBKEY',0x$handle_admin_pubkey,0,86400,<%= scope.function_time([]) %>,'',1,1,1,0);
+/*!40000 ALTER TABLE \`handles\` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Dumping data for table \`nas\`
+--
+
+LOCK TABLES \`nas\` WRITE;
+/*!40000 ALTER TABLE \`nas\` DISABLE KEYS */;
+INSERT INTO \`nas\` VALUES ('0.NA/<%= @hdl_prefix %>');
+/*!40000 ALTER TABLE \`nas\` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2016-04-08  9:43:09
+
+EOF