diff --git a/dev/vagrant/dolibarrdev/Vagrantfile b/dev/vagrant/dolibarrdev/Vagrantfile
index a4094aa24e4905f5a4ab23a196a88fff99c378b8..e384eb2976bc62b6c8b05e3fd96b5024661c885f 100644
--- a/dev/vagrant/dolibarrdev/Vagrantfile
+++ b/dev/vagrant/dolibarrdev/Vagrantfile
@@ -5,6 +5,10 @@ dir = File.dirname(File.expand_path(__FILE__))
 configValues = YAML.load_file("#{dir}/puphpet/config.yaml")
 data = configValues['vagrantfile-local']
 
+if !data['vm']['provider']['virtualbox'].empty?
+  ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'
+end
+
 Vagrant.configure("2") do |config|
   config.vm.box = "#{data['vm']['box']}"
   config.vm.box_url = "#{data['vm']['box_url']}"
@@ -26,7 +30,7 @@ Vagrant.configure("2") do |config|
   data['vm']['synced_folder'].each do |i, folder|
     if folder['source'] != '' && folder['target'] != '' && folder['id'] != ''
       nfs = (folder['nfs'] == "true") ? "nfs" : nil
-      config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{folder['id']}", type: nfs
+      config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{folder['id']}", type: nfs, :mount_options => ["dmode=777","fmode=666"]
     end
   end
 
@@ -48,12 +52,14 @@ Vagrant.configure("2") do |config|
     s.args = "/vagrant/puphpet"
   end
   config.vm.provision :shell, :path => "puphpet/shell/update-puppet.sh"
-  config.vm.provision :shell, :path => "puphpet/shell/librarian-puppet-vagrant.sh"
+  config.vm.provision :shell, :path => "puphpet/shell/r10k.sh"
 
   config.vm.provision :puppet do |puppet|
     ssh_username = !data['ssh']['username'].nil? ? data['ssh']['username'] : "vagrant"
     puppet.facter = {
-      "ssh_username" => "#{ssh_username}"
+      "ssh_username"     => "#{ssh_username}",
+      "provisioner_type" => ENV['VAGRANT_DEFAULT_PROVIDER'],
+      "vm_target_key"    => 'vagrantfile-local',
     }
     puppet.manifests_path = "#{data['vm']['provision']['puppet']['manifests_path']}"
     puppet.manifest_file = "#{data['vm']['provision']['puppet']['manifest_file']}"
@@ -63,6 +69,20 @@ Vagrant.configure("2") do |config|
     end
   end
 
+  if File.file?("#{dir}/puphpet/files/dot/ssh/id_rsa")
+    config.ssh.private_key_path = [
+      "#{dir}/puphpet/files/dot/ssh/id_rsa",
+      "#{dir}/puphpet/files/dot/ssh/insecure_private_key"
+    ]
+  end
+
+  ssh_username = !data['ssh']['username'].nil? ? data['ssh']['username'] : "vagrant"
+
+  config.vm.provision "shell" do |kg|
+    kg.path = "puphpet/shell/ssh-keygen.sh"
+    kg.args = "#{ssh_username}"
+  end
+
   config.vm.provision :shell, :path => "puphpet/shell/execute-files.sh"
 
   if !data['ssh']['host'].nil?
@@ -71,9 +91,6 @@ Vagrant.configure("2") do |config|
   if !data['ssh']['port'].nil?
     config.ssh.port = "#{data['ssh']['port']}"
   end
-  if !data['ssh']['private_key_path'].nil?
-    config.ssh.private_key_path = "#{data['ssh']['private_key_path']}"
-  end
   if !data['ssh']['username'].nil?
     config.ssh.username = "#{data['ssh']['username']}"
   end
diff --git a/dev/vagrant/dolibarrdev/puphpet/.gitattributes b/dev/vagrant/dolibarrdev/puphpet/.gitattributes
new file mode 100644
index 0000000000000000000000000000000000000000..93f9975f88ed4a7bf48ddc7031e0b2303249ed57
--- /dev/null
+++ b/dev/vagrant/dolibarrdev/puphpet/.gitattributes
@@ -0,0 +1,10 @@
+# Autodetect text files
+* text=auto
+
+# Force the following filetypes to have unix eols, so Windows does not break them
+*.pp text eol=lf
+*.sh text eol=lf
+*.yaml text eol=lf
+Puppetfile text eol=lf
+.bash_aliases text eol=lf
+.vimrc text eol=lf
diff --git a/dev/vagrant/dolibarrdev/puphpet/config.yaml b/dev/vagrant/dolibarrdev/puphpet/config.yaml
index e54c453276622c1abd8af90d338c0b949a66b201..d5610f0928afb58acd36a3fcd41da99a029fbb1e 100644
--- a/dev/vagrant/dolibarrdev/puphpet/config.yaml
+++ b/dev/vagrant/dolibarrdev/puphpet/config.yaml
@@ -7,7 +7,7 @@ vagrantfile-local:
         network:
             private_network: 192.168.42.101
             forwarded_port:
-                jHkzZVuBoVtG:
+                XnCD0YcW5aic:
                     host: '9252'
                     guest: '22'
         provider:
@@ -26,8 +26,7 @@ vagrantfile-local:
                     - '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
                     - '--parser future'
         synced_folder:
-            vMRGvEXBrASV:
-                id: vagrant-root
+            bH8PX003LLNi:
                 source: ../../../
                 target: /var/www
                 nfs: 'false'
@@ -59,14 +58,22 @@ mailcatcher:
         smtp_port: 1025
         http_ip: 0.0.0.0
         http_port: '1080'
-        path: /usr/local/bin
-        log: /var/log/mailcatcher/mailcatcher.log
+        mailcatcher_path: /usr/local/bin
+        log_path: /var/log/mailcatcher/mailcatcher.log
 apache:
+    install: '1'
+    settings:
+        user: www-data
+        group: www-data
+        default_vhost: true
+        manage_user: false
+        manage_group: false
+        sendfile: 0
     modules:
         - php
         - rewrite
     vhosts:
-        fIrYPRDORtSV:
+        2iyFAvXD9OZU:
             servername: dev.dolibarr.org
             docroot: /var/www/htdocs
             port: '80'
@@ -74,11 +81,28 @@ apache:
                 - 'APP_ENV dev'
             override:
                 - All
-    user: www-data
-    group: www-data
-    default_vhost: true
+            custom_fragment: ''
+            ssl_cert: ''
+            ssl_key: ''
+            ssl_chain: ''
+            ssl_certs_dir: ''
     mod_pagespeed: 0
     mod_spdy: 0
+nginx:
+    install: 0
+    vhosts:
+        N7iqVXFhLCgi:
+            server_name: awesome.dev
+            server_aliases:
+                - www.awesome.dev
+            www_root: /var/www/awesome.dev
+            listen_port: '80'
+            index_files:
+                - index.html
+                - index.htm
+                - index.php
+            envvars:
+                - 'APP_ENV dev'
 php:
     install: '1'
     version: '55'
@@ -115,11 +139,12 @@ drush:
     settings:
         drush.tag_branch: 6.x
 mysql:
+    install: '1'
     root_password: root
     phpmyadmin: '1'
     adminer: 0
     databases:
-        K7xpd6KqfK3E:
+        8oNQ7e6GCpdw:
             grant:
                 - ALTER
                 - CREATE
@@ -134,11 +159,32 @@ mysql:
             user: user
             password: user
             sql_file: /var/www/dev/initdata/mysqldump_dolibarr_3.5.0.sql
+postgresql:
+    install: 0
+    settings:
+        root_password: '123'
+        user_group: postgres
+        encoding: UTF8
+        version: '9.3'
+    databases: {  }
+    adminer: 0
+mariadb:
+    install: 0
+    root_password: '123'
+    phpmyadmin: 0
+    adminer: 0
+    databases: {  }
+    version: '10.0'
 mongodb:
     install: 0
-    auth: 1
-    port: '27017'
+    settings:
+        auth: 1
+        port: '27017'
     databases: {  }
+redis:
+    install: 0
+    settings:
+        conf_port: '6379'
 beanstalkd:
     install: 0
     settings:
@@ -153,5 +199,6 @@ beanstalkd:
     binlogdir: /var/lib/beanstalkd/binlog
 rabbitmq:
     install: 0
-    port: '5672'
+    settings:
+        port: '5672'
 
diff --git a/dev/vagrant/dolibarrdev/puphpet/files/dot/.gitignore b/dev/vagrant/dolibarrdev/puphpet/files/dot/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..2e403e0fae049992ec810408210e6808a9c76a9c
--- /dev/null
+++ b/dev/vagrant/dolibarrdev/puphpet/files/dot/.gitignore
@@ -0,0 +1,3 @@
+ssh/id_rsa
+ssh/id_rsa.pub
+ssh/insecure_private_key
\ No newline at end of file
diff --git a/dev/vagrant/dolibarrdev/puphpet/files/dot/ssh/insecure_private_key b/dev/vagrant/dolibarrdev/puphpet/files/dot/ssh/insecure_private_key
new file mode 100644
index 0000000000000000000000000000000000000000..7d6a083909e03080065e9a93a37b4ae7b8cf8ecd
--- /dev/null
+++ b/dev/vagrant/dolibarrdev/puphpet/files/dot/ssh/insecure_private_key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
+w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
+kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
+hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
+Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
+yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd
+ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1
+Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf
+TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK
+iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A
+sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf
+4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP
+cXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk
+EjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN
+CAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX
+3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG
+YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj
+3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+
+dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz
+6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC
+P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF
+llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ
+kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
++vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
+NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
+-----END RSA PRIVATE KEY-----
diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/Puppetfile b/dev/vagrant/dolibarrdev/puphpet/puppet/Puppetfile
index 8b6cc92cb677bbdc2ecde78458af2a22930a2ba1..a825c5617cba33c5a9e343994cad2a313927f26d 100644
--- a/dev/vagrant/dolibarrdev/puphpet/puppet/Puppetfile
+++ b/dev/vagrant/dolibarrdev/puphpet/puppet/Puppetfile
@@ -6,14 +6,20 @@ mod 'yum', :git => 'https://github.com/puphpet/puppet-yum.git'
 mod 'vcsrepo', :git => 'https://github.com/puphpet/puppetlabs-vcsrepo.git'
 mod 'ntp', :git => 'https://github.com/puphpet/puppetlabs-ntp.git'
 mod 'iptables', :git => 'https://github.com/puphpet/puppet-iptables.git'
+mod 'git', :git => 'https://github.com/puphpet/puppetlabs-git.git'
 mod 'mailcatcher', :git => 'https://github.com/puphpet/puppet-mailcatcher.git'
 mod 'supervisord', :git => 'https://github.com/puphpet/puppet-supervisord.git'
 mod 'apache', :git => 'https://github.com/puphpet/puppetlabs-apache.git'
+mod 'nginx', :git => 'https://github.com/puphpet/puppet-nginx.git'
 mod 'php', :git => 'https://github.com/puphpet/puppet-php.git'
 mod 'composer', :git => 'https://github.com/puphpet/puppet-composer.git'
 mod 'puphpet', :git => 'https://github.com/puphpet/puppet-puphpet.git'
+mod 'puppi', :git => 'https://github.com/puphpet/puppi.git'
 mod 'drush', :git => 'https://github.com/puphpet/puppet-drush.git', :ref => 'new'
 mod 'mysql', :git => 'https://github.com/puphpet/puppetlabs-mysql.git'
+mod 'postgresql', :git => 'https://github.com/puphpet/puppetlabs-postgresql.git'
 mod 'mongodb', :git => 'https://github.com/puphpet/puppetlabs-mongodb.git'
+mod 'redis', :git => 'https://github.com/puphpet/puppet-redis.git'
 mod 'beanstalkd', :git => 'https://github.com/puphpet/puppet-beanstalkd.git'
 mod 'rabbitmq', :git => 'https://github.com/puphpet/puppetlabs-rabbitmq.git'
+mod 'staging', :git => 'https://github.com/puphpet/puppet-staging.git'
diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp
index 7480726aa63b63dc0d9d3ec6abad4e95ac79db41..50dc7fc0182e668866f9f367c1c75b7c03682e44 100644
--- a/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp
+++ b/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp
@@ -2,20 +2,27 @@
 
 if $server_values == undef {
   $server_values = hiera('server', false)
+} if $vm_values == undef {
+  $vm_values = hiera($::vm_target_key, false)
 }
-
 # Ensure the time is accurate, reducing the possibilities of apt repositories
 # failing for invalid certificates
-include '::ntp'
+class { 'ntp': }
+
+include 'puphpet'
+include 'puphpet::params'
 
 Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ] }
 group { 'puppet':   ensure => present }
 group { 'www-data': ensure => present }
+group { 'www-user': ensure => present }
 
 user { $::ssh_username:
-  shell  => '/bin/bash',
-  home   => "/home/${::ssh_username}",
-  ensure => present
+  shell   => '/bin/bash',
+  home    => "/home/${::ssh_username}",
+  ensure  => present,
+  groups  => ['www-data', 'www-user'],
+  require => [Group['www-data'], Group['www-user']]
 }
 
 user { ['apache', 'nginx', 'httpd', 'www-data']:
@@ -130,7 +137,7 @@ case $::operatingsystem {
 
     add_dotdeb { 'packages.dotdeb.org': release => $lsbdistcodename }
 
-   if is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 {
+   if hash_key_equals($php_values, 'install', 1) {
       # Debian Squeeze 6.0 can do PHP 5.3 (default) and 5.4
       if $lsbdistcodename == 'squeeze' and $php_values['version'] == '54' {
         add_dotdeb { 'packages.dotdeb.org-php54': release => 'squeeze-php54' }
@@ -156,9 +163,13 @@ case $::operatingsystem {
       key_server => 'hkp://keyserver.ubuntu.com:80'
     }
 
-    apt::ppa { 'ppa:pdoes/ppa': require => Apt::Key['4CBEDD5A'] }
+    if $lsbdistcodename in ['lucid', 'precise'] {
+      apt::ppa { 'ppa:pdoes/ppa': require => Apt::Key['4CBEDD5A'], options => '' }
+    } else {
+      apt::ppa { 'ppa:pdoes/ppa': require => Apt::Key['4CBEDD5A'] }
+    }
 
-    if is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 {
+    if hash_key_equals($php_values, 'install', 1) {
       # Ubuntu Lucid 10.04, Precise 12.04, Quantal 12.10 and Raring 13.04 can do PHP 5.3 (default <= 12.10) and 5.4 (default <= 13.04)
       if $lsbdistcodename in ['lucid', 'precise', 'quantal', 'raring'] and $php_values['version'] == '54' {
         if $lsbdistcodename == 'lucid' {
@@ -177,7 +188,7 @@ case $::operatingsystem {
     }
   }
   'redhat', 'centos': {
-    if is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 {
+    if hash_key_equals($php_values, 'install', 1) {
       if $php_values['version'] == '54' {
         class { 'yum::repo::remi': }
       }
@@ -206,38 +217,58 @@ define add_dotdeb ($release){
   }
 }
 
+# Begin open ports for Iptables
+if $::osfamily == 'redhat'
+  and has_key($vm_values, 'vm')
+  and has_key($vm_values['vm'], 'network')
+  and has_key($vm_values['vm']['network'], 'forwarded_port')
+{
+  create_resources( iptables_port, $vm_values['vm']['network']['forwarded_port'] )
+}
+
+define iptables_port (
+  $host,
+  $guest,
+) {
+  if ( ! defined(Iptables::Allow["tcp/${guest}"]) ) {
+    iptables::allow { "tcp/${guest}":
+      port     => $guest,
+      protocol => 'tcp'
+    }
+  }
+}
+
 ## Begin MailCatcher manifest
 
 if $mailcatcher_values == undef {
   $mailcatcher_values = hiera('mailcatcher', false)
 }
 
-if is_hash($mailcatcher_values) and has_key($mailcatcher_values, 'install') and $mailcatcher_values['install'] == 1 {
-  $mailcatcher_path       = $mailcatcher_values['settings']['path']
-  $mailcatcher_smtp_ip    = $mailcatcher_values['settings']['smtp_ip']
-  $mailcatcher_smtp_port  = $mailcatcher_values['settings']['smtp_port']
-  $mailcatcher_http_ip    = $mailcatcher_values['settings']['http_ip']
-  $mailcatcher_http_port  = $mailcatcher_values['settings']['http_port']
-  $mailcatcher_log        = $mailcatcher_values['settings']['log']
-
-  class { 'mailcatcher':
-    mailcatcher_path => $mailcatcher_path,
-    smtp_ip          => $mailcatcher_smtp_ip,
-    smtp_port        => $mailcatcher_smtp_port,
-    http_ip          => $mailcatcher_http_ip,
-    http_port        => $mailcatcher_http_port,
+if hash_key_equals($mailcatcher_values, 'install', 1) {
+  if ! defined(Package['tilt']) {
+    package { 'tilt':
+      ensure   => '1.3',
+      provider => 'gem',
+      before   => Class['mailcatcher']
+    }
   }
 
-  if $::osfamily == 'redhat' and ! defined(Iptables::Allow["tcp/${mailcatcher_smtp_port}"]) {
-    iptables::allow { "tcp/${mailcatcher_smtp_port}":
-      port     => $mailcatcher_smtp_port,
+  create_resources('class', { 'mailcatcher' => $mailcatcher_values['settings'] })
+
+  if $::osfamily == 'redhat'
+    and ! defined(Iptables::Allow["tcp/${mailcatcher_values['settings']['smtp_port']}"])
+  {
+    iptables::allow { "tcp/${mailcatcher_values['settings']['smtp_port']}":
+      port     => $mailcatcher_values['settings']['smtp_port'],
       protocol => 'tcp'
     }
   }
 
-  if $::osfamily == 'redhat' and ! defined(Iptables::Allow["tcp/${mailcatcher_http_port}"]) {
-    iptables::allow { "tcp/${mailcatcher_http_port}":
-      port     => $mailcatcher_http_port,
+  if $::osfamily == 'redhat'
+    and ! defined(Iptables::Allow["tcp/${mailcatcher_values['settings']['http_port']}"])
+  {
+    iptables::allow { "tcp/${mailcatcher_values['settings']['http_port']}":
+      port     => $mailcatcher_values['settings']['http_port'],
       protocol => 'tcp'
     }
   }
@@ -249,13 +280,13 @@ if is_hash($mailcatcher_values) and has_key($mailcatcher_values, 'install') and
   }
 
   $supervisord_mailcatcher_options = sort(join_keys_to_values({
-    ' --smtp-ip'   => $mailcatcher_smtp_ip,
-    ' --smtp-port' => $mailcatcher_smtp_port,
-    ' --http-ip'   => $mailcatcher_http_ip,
-    ' --http-port' => $mailcatcher_http_port
+    ' --smtp-ip'   => $mailcatcher_values['settings']['smtp_ip'],
+    ' --smtp-port' => $mailcatcher_values['settings']['smtp_port'],
+    ' --http-ip'   => $mailcatcher_values['settings']['http_ip'],
+    ' --http-port' => $mailcatcher_values['settings']['http_port']
   }, ' '))
 
-  $supervisord_mailcatcher_cmd = "mailcatcher ${supervisord_mailcatcher_options} -f  >> ${mailcatcher_log}"
+  $supervisord_mailcatcher_cmd = "mailcatcher ${supervisord_mailcatcher_options} -f  >> ${mailcatcher_values['settings']['log']}"
 
   supervisord::program { 'mailcatcher':
     command     => $supervisord_mailcatcher_cmd,
@@ -264,7 +295,7 @@ if is_hash($mailcatcher_values) and has_key($mailcatcher_values, 'install') and
     autostart   => true,
     autorestart => true,
     environment => {
-      'PATH' => "/bin:/sbin:/usr/bin:/usr/sbin:${mailcatcher_path}"
+      'PATH' => "/bin:/sbin:/usr/bin:/usr/sbin:${mailcatcher_values['settings']['path']}"
     },
     require => Package['mailcatcher']
   }
@@ -274,98 +305,158 @@ if is_hash($mailcatcher_values) and has_key($mailcatcher_values, 'install') and
 
 if $yaml_values == undef {
   $yaml_values = loadyaml('/vagrant/puphpet/config.yaml')
-}
-
-if $apache_values == undef {
+} if $apache_values == undef {
   $apache_values = $yaml_values['apache']
-}
-
-if $php_values == undef {
+} if $php_values == undef {
   $php_values = hiera('php', false)
-}
-
-if $hhvm_values == undef {
+} if $hhvm_values == undef {
   $hhvm_values = hiera('hhvm', false)
 }
 
-include puphpet::params
-include apache::params
+if hash_key_equals($apache_values, 'install', 1) {
+  include puphpet::params
+  include apache::params
 
-$webroot_location = $puphpet::params::apache_webroot_location
+  $webroot_location = $puphpet::params::apache_webroot_location
 
-exec { "exec mkdir -p ${webroot_location}":
-  command => "mkdir -p ${webroot_location}",
-  creates => $webroot_location,
-}
+  exec { "exec mkdir -p ${webroot_location}":
+    command => "mkdir -p ${webroot_location}",
+    creates => $webroot_location,
+  }
 
-if ! defined(File[$webroot_location]) {
-  file { $webroot_location:
-    ensure  => directory,
-    group   => 'www-data',
-    mode    => 0775,
-    require => [
-      Exec["exec mkdir -p ${webroot_location}"],
-      Group['www-data']
-    ]
+  if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
+    and ! defined(File[$webroot_location])
+  {
+    file { $webroot_location:
+      ensure  => directory,
+      mode    => 0775,
+      require => [
+        Exec["exec mkdir -p ${webroot_location}"],
+        Group['www-data']
+      ]
+    }
   }
-}
 
-if is_hash($hhvm_values) and has_key($hhvm_values, 'install') and $hhvm_values['install'] == 1 {
-  $mpm_module           = 'worker'
-  $disallowed_modules   = ['php']
-  $apache_conf_template = 'puphpet/apache/hhvm-httpd.conf.erb'
-} elsif (is_hash($php_values)) {
-  $mpm_module           = 'prefork'
-  $disallowed_modules   = []
-  $apache_conf_template = $apache::params::conf_template
-} else {
-  $mpm_module           = 'prefork'
-  $disallowed_modules   = []
-  $apache_conf_template = $apache::params::conf_template
-}
+  if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
+    and ! defined(File[$webroot_location])
+  {
+    file { $webroot_location:
+      ensure  => directory,
+      group   => 'www-data',
+      mode    => 0775,
+      require => [
+        Exec["exec mkdir -p ${webroot_location}"],
+        Group['www-data']
+      ]
+    }
+  }
 
-class { 'apache':
-  user          => $apache_values['user'],
-  group         => $apache_values['group'],
-  default_vhost => true,
-  mpm_module    => $mpm_module,
-  manage_user   => false,
-  manage_group  => false,
-  conf_template => $apache_conf_template
-}
+  if hash_key_equals($hhvm_values, 'install', 1) {
+    $mpm_module           = 'worker'
+    $disallowed_modules   = ['php']
+    $apache_conf_template = 'puphpet/apache/hhvm-httpd.conf.erb'
+    $apache_php_package   = 'hhvm'
+  } elsif hash_key_equals($php_values, 'install', 1) {
+    $mpm_module           = 'prefork'
+    $disallowed_modules   = []
+    $apache_conf_template = $apache::params::conf_template
+    $apache_php_package   = 'php'
+  } else {
+    $mpm_module           = 'prefork'
+    $disallowed_modules   = []
+    $apache_conf_template = $apache::params::conf_template
+    $apache_php_package   = ''
+  }
 
-if $::osfamily == 'redhat' and ! defined(Iptables::Allow['tcp/80']) {
-  iptables::allow { 'tcp/80':
-    port     => '80',
-    protocol => 'tcp'
+  if $::operatingsystem == 'ubuntu'
+  and hash_key_equals($php_values, 'install', 1)
+  and hash_key_equals($php_values, 'version', 55)
+  {
+    $apache_version = '2.4'
+  } else {
+    $apache_version = $apache::version::default
   }
-}
 
-if has_key($apache_values, 'mod_pagespeed') and $apache_values['mod_pagespeed'] == 1 {
-  class { 'puphpet::apache::modpagespeed': }
-}
+  $apache_settings = merge($apache_values['settings'], {
+    'mpm_module'     => $mpm_module,
+    'conf_template'  => $apache_conf_template,
+    'sendfile'       => $apache_values['settings']['sendfile'] ? { 1 => 'On', default => 'Off' },
+    'apache_version' => $apache_version
+  })
 
-if has_key($apache_values, 'mod_spdy') and $apache_values['mod_spdy'] == 1 {
-  class { 'puphpet::apache::modspdy': }
-}
+  create_resources('class', { 'apache' => $apache_settings })
 
-if count($apache_values['vhosts']) > 0 {
-  each( $apache_values['vhosts'] ) |$key, $vhost| {
-    exec { "exec mkdir -p ${vhost['docroot']} @ key ${key}":
-      command => "mkdir -p ${vhost['docroot']}",
-      creates => $vhost['docroot'],
+  if $::osfamily == 'redhat' and ! defined(Iptables::Allow['tcp/80']) {
+    iptables::allow { 'tcp/80':
+      port     => '80',
+      protocol => 'tcp'
     }
+  }
 
-    if ! defined(File[$vhost['docroot']]) {
-      file { $vhost['docroot']:
-        ensure  => directory,
-        require => Exec["exec mkdir -p ${vhost['docroot']} @ key ${key}"]
+  if $::osfamily == 'redhat' and ! defined(Iptables::Allow['tcp/443']) {
+    iptables::allow { 'tcp/443':
+      port     => '443',
+      protocol => 'tcp'
+    }
+  }
+
+  if hash_key_equals($apache_values, 'mod_pagespeed', 1) {
+    class { 'puphpet::apache::modpagespeed': }
+  }
+
+  if hash_key_equals($apache_values, 'mod_spdy', 1) {
+    class { 'puphpet::apache::modspdy':
+      php_package => $apache_php_package
+    }
+  }
+
+  if count($apache_values['vhosts']) > 0 {
+    each( $apache_values['vhosts'] ) |$key, $vhost| {
+      exec { "exec mkdir -p ${vhost['docroot']} @ key ${key}":
+        command => "mkdir -p ${vhost['docroot']}",
+        creates => $vhost['docroot'],
       }
+
+      if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
+        and ! defined(File[$vhost['docroot']])
+      {
+        file { $vhost['docroot']:
+          ensure  => directory,
+          mode    => 0765,
+          require => Exec["exec mkdir -p ${vhost['docroot']} @ key ${key}"]
+        }
+      }
+
+      if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
+        and ! defined(File[$vhost['docroot']])
+      {
+        file { $vhost['docroot']:
+          ensure  => directory,
+          group   => 'www-user',
+          mode    => 0765,
+          require => [
+            Exec["exec mkdir -p ${vhost['docroot']} @ key ${key}"],
+            Group['www-user']
+          ]
+        }
+      }
+
+      create_resources(apache::vhost, { "${key}" => merge($vhost, {
+          'custom_fragment' => template('puphpet/apache/custom_fragment.erb'),
+          'ssl'             => 'ssl' in $vhost and str2bool($vhost['ssl']) ? { true => true, default => false },
+          'ssl_cert'        => $vhost['ssl_cert'] ? { undef => undef, '' => undef, default => $vhost['ssl_cert'] },
+          'ssl_key'         => $vhost['ssl_key'] ? { undef => undef, '' => undef, default => $vhost['ssl_key'] },
+          'ssl_chain'       => $vhost['ssl_chain'] ? { undef => undef, '' => undef, default => $vhost['ssl_chain'] },
+          'ssl_certs_dir'   => $vhost['ssl_certs_dir'] ? { undef => undef, '' => undef, default => $vhost['ssl_certs_dir'] }
+        })
+      })
     }
   }
-}
 
-create_resources(apache::vhost, $apache_values['vhosts'])
+  if count($apache_values['modules']) > 0 {
+    apache_mod { $apache_values['modules']: }
+  }
+}
 
 define apache_mod {
   if ! defined(Class["apache::mod::${name}"]) and !($name in $disallowed_modules) {
@@ -373,25 +464,189 @@ define apache_mod {
   }
 }
 
-if count($apache_values['modules']) > 0 {
-  apache_mod { $apache_values['modules']: }
+## Begin Nginx manifest
+
+if $nginx_values == undef {
+   $nginx_values = hiera('nginx', false)
+} if $php_values == undef {
+   $php_values = hiera('php', false)
+} if $hhvm_values == undef {
+  $hhvm_values = hiera('hhvm', false)
 }
 
-## Begin PHP manifest
+if hash_key_equals($nginx_values, 'install', 1) {
+  if $lsbdistcodename == 'lucid' and hash_key_equals($php_values, 'version', '53') {
+    apt::key { '67E15F46': key_server => 'hkp://keyserver.ubuntu.com:80' }
+    apt::ppa { 'ppa:l-mierzwa/lucid-php5':
+      options => '',
+      require => Apt::Key['67E15F46']
+    }
+  }
 
-if $php_values == undef {
-  $php_values = hiera('php', false)
+  $webroot_location = $puphpet::params::nginx_webroot_location
+
+  exec { "exec mkdir -p ${webroot_location}":
+    command => "mkdir -p ${webroot_location}",
+    onlyif  => "test -d ${webroot_location}",
+  }
+
+  if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
+    and ! defined(File[$webroot_location])
+  {
+    file { $webroot_location:
+      ensure  => directory,
+      mode    => 0775,
+      require => [
+        Exec["exec mkdir -p ${webroot_location}"],
+        Group['www-data']
+      ]
+    }
+  }
+
+  if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
+    and ! defined(File[$webroot_location])
+  {
+    file { $webroot_location:
+      ensure  => directory,
+      group   => 'www-data',
+      mode    => 0775,
+      require => [
+        Exec["exec mkdir -p ${webroot_location}"],
+        Group['www-data']
+      ]
+    }
+  }
+
+  if hash_key_equals($php_values, 'install', 1) {
+    $php5_fpm_sock = '/var/run/php5-fpm.sock'
+
+    if $php_values['version'] == undef {
+      $fastcgi_pass = null
+    } elsif $php_values['version'] == '53' {
+      $fastcgi_pass = '127.0.0.1:9000'
+    } else {
+      $fastcgi_pass = "unix:${php5_fpm_sock}"
+    }
+
+    $fastcgi_param_parts = [
+      'PATH_INFO $fastcgi_path_info',
+      'PATH_TRANSLATED $document_root$fastcgi_path_info',
+      'SCRIPT_FILENAME $document_root$fastcgi_script_name'
+    ]
+
+    if $::osfamily == 'redhat' and $fastcgi_pass == "unix:${php5_fpm_sock}" {
+      exec { "create ${php5_fpm_sock} file":
+        command => "touch ${php5_fpm_sock} && chmod 777 ${php5_fpm_sock}",
+        onlyif  => ["test ! -f ${php5_fpm_sock}", "test ! -f ${php5_fpm_sock}="],
+        require => Package['nginx']
+      }
+
+      exec { "listen = 127.0.0.1:9000 => listen = ${php5_fpm_sock}":
+        command => "perl -p -i -e 's#listen = 127.0.0.1:9000#listen = ${php5_fpm_sock}#gi' /etc/php-fpm.d/www.conf",
+        unless  => "grep -c 'listen = 127.0.0.1:9000' '${php5_fpm_sock}'",
+        notify  => [
+          Class['nginx::service'],
+          Service['php-fpm']
+        ],
+        require => Exec["create ${php5_fpm_sock} file"]
+      }
+    }
+  } elsif hash_key_equals($hhvm_values, 'install', 1) {
+    $fastcgi_pass        = '127.0.0.1:9000'
+    $fastcgi_param_parts = [
+      'SCRIPT_FILENAME $document_root$fastcgi_script_name'
+    ]
+  } else {
+    $fastcgi_pass        = ''
+    $fastcgi_param_parts = []
+  }
+
+  class { 'nginx': }
+
+  if count($nginx_values['vhosts']) > 0 {
+    each( $nginx_values['vhosts'] ) |$key, $vhost| {
+      exec { "exec mkdir -p ${vhost['www_root']} @ key ${key}":
+        command => "mkdir -p ${vhost['www_root']}",
+        creates => $vhost['docroot'],
+      }
+
+      if ! defined(File[$vhost['www_root']]) {
+        file { $vhost['www_root']:
+          ensure  => directory,
+          require => Exec["exec mkdir -p ${vhost['www_root']} @ key ${key}"]
+        }
+      }
+    }
+
+    create_resources(nginx_vhost, $nginx_values['vhosts'])
+  }
+
+  if $::osfamily == 'redhat' and ! defined(Iptables::Allow['tcp/80']) {
+    iptables::allow { 'tcp/80':
+      port     => '80',
+      protocol => 'tcp'
+    }
+  }
 }
 
-if $apache_values == undef {
-  $apache_values = hiera('apache', false)
+define nginx_vhost (
+  $server_name,
+  $server_aliases = [],
+  $www_root,
+  $listen_port,
+  $index_files,
+  $envvars = [],
+){
+  $merged_server_name = concat([$server_name], $server_aliases)
+
+  if is_array($index_files) and count($index_files) > 0 {
+    $try_files = $index_files[count($index_files) - 1]
+  } else {
+    $try_files = 'index.php'
+  }
+
+  nginx::resource::vhost { $server_name:
+    server_name      => $merged_server_name,
+    www_root         => $www_root,
+    listen_port      => $listen_port,
+    index_files      => $index_files,
+    try_files        => ['$uri', '$uri/', "/${try_files}?\$args"],
+    vhost_cfg_append => {
+       sendfile => 'off'
+    }
+  }
+
+  $fastcgi_param = concat($fastcgi_param_parts, $envvars)
+
+  nginx::resource::location { "${server_name}-php":
+    ensure              => present,
+    vhost               => $server_name,
+    location            => '~ \.php$',
+    proxy               => undef,
+    try_files           => ['$uri', '$uri/', "/${try_files}?\$args"],
+    www_root            => $www_root,
+    location_cfg_append => {
+      'fastcgi_split_path_info' => '^(.+\.php)(/.+)$',
+      'fastcgi_param'           => $fastcgi_param,
+      'fastcgi_pass'            => $fastcgi_pass,
+      'fastcgi_index'           => 'index.php',
+      'include'                 => 'fastcgi_params'
+    },
+    notify              => Class['nginx::service'],
+  }
 }
 
-if $nginx_values == undef {
+## Begin PHP manifest
+
+if $php_values == undef {
+  $php_values = hiera('php', false)
+} if $apache_values == undef {
+  $apache_values = hiera('apache', false)
+} if $nginx_values == undef {
   $nginx_values = hiera('nginx', false)
 }
 
-if is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 {
+if hash_key_equals($php_values, 'install', 1) {
   Class['Php'] -> Class['Php::Devel'] -> Php::Module <| |> -> Php::Pear::Module <| |> -> Php::Pecl::Module <| |>
 
   if $php_prefix == undef {
@@ -408,7 +663,7 @@ if is_hash($php_values) and has_key($php_values, 'install') and $php_values['ins
     }
   }
 
-  if is_hash($apache_values) {
+  if hash_key_equals($apache_values, 'install', 1) {
     include apache::params
 
     if has_key($apache_values, 'mod_spdy') and $apache_values['mod_spdy'] == 1 {
@@ -424,7 +679,7 @@ if is_hash($php_values) and has_key($php_values, 'install') and $php_values['ins
     class { 'php':
       service => $php_webserver_service
     }
-  } elsif is_hash($nginx_values) {
+  } elsif hash_key_equals($nginx_values, 'install', 1) {
     include nginx::params
 
     $php_webserver_service     = "${php_prefix}fpm"
@@ -511,7 +766,7 @@ if is_hash($php_values) and has_key($php_values, 'install') and $php_values['ins
     webserver   => $php_webserver_service_ini
   }
 
-  if $php_values['composer'] == 1 {
+  if hash_key_equals($php_values, 'composer', 1) {
     class { 'composer':
       target_dir      => '/usr/local/bin',
       composer_file   => 'composer',
@@ -525,22 +780,27 @@ if is_hash($php_values) and has_key($php_values, 'install') and $php_values['ins
   }
 }
 
-
 define php_mod {
-  php::module { $name:
-    service_autorestart => $php_webserver_restart,
+  if ! defined(Php::Module[$name]) {
+    php::module { $name:
+      service_autorestart => $php_webserver_restart,
+    }
   }
 }
 define php_pear_mod {
-  php::pear::module { $name:
-    use_package         => false,
-    service_autorestart => $php_webserver_restart,
+  if ! defined(Php::Pear::Module[$name]) {
+    php::pear::module { $name:
+      use_package         => false,
+      service_autorestart => $php_webserver_restart,
+    }
   }
 }
 define php_pecl_mod {
-  php::pecl::module { $name:
-    use_package         => false,
-    service_autorestart => $php_webserver_restart,
+  if ! defined(Php::Pecl::Module[$name]) {
+    php::pecl::module { $name:
+      use_package         => false,
+      service_autorestart => $php_webserver_restart,
+    }
   }
 }
 
@@ -548,30 +808,25 @@ define php_pecl_mod {
 
 if $xdebug_values == undef {
   $xdebug_values = hiera('xdebug', false)
-}
-
-if $php_values == undef {
+} if $php_values == undef {
   $php_values = hiera('php', false)
-}
-
-if $apache_values == undef {
+} if $apache_values == undef {
   $apache_values = hiera('apache', false)
-}
-
-if $nginx_values == undef {
+} if $nginx_values == undef {
   $nginx_values = hiera('nginx', false)
 }
 
-if is_hash($apache_values) {
+if hash_key_equals($apache_values, 'install', 1) {
   $xdebug_webserver_service = 'httpd'
-} elsif is_hash($nginx_values) {
+} elsif hash_key_equals($nginx_values, 'install', 1) {
   $xdebug_webserver_service = 'nginx'
 } else {
   $xdebug_webserver_service = undef
 }
 
-if (is_hash($xdebug_values) and has_key($xdebug_values, 'install') and $xdebug_values['install'] == 1)
-  and is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 {
+if hash_key_equals($xdebug_values, 'install', 1)
+  and hash_key_equals($php_values, 'install', 1)
+{
   class { 'puphpet::xdebug':
     webserver => $xdebug_webserver_service
   }
@@ -590,26 +845,19 @@ if (is_hash($xdebug_values) and has_key($xdebug_values, 'install') and $xdebug_v
 
 ## Begin Xhprof manifest
 
-if $xhprof_values == undef {
+if $php_values == undef {
+  $php_values = hiera('php', false)
+} if $xhprof_values == undef {
   $xhprof_values = hiera('xhprof', false)
-}
-
-if $apache_values == undef {
+} if $apache_values == undef {
   $apache_values = hiera('apache', false)
-}
-
-if $nginx_values == undef {
+} if $nginx_values == undef {
   $nginx_values = hiera('nginx', false)
 }
 
-if is_hash($apache_values) or is_hash($nginx_values) {
-  $xhprof_webserver_restart = true
-} else  {
-  $xhprof_webserver_restart = false
-}
-
-if (is_hash($xhprof_values) and has_key($xhprof_values, 'install') and $xhprof_values['install'] == 1)
-  and is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 {
+if hash_key_equals($xhprof_values, 'install', 1)
+  and hash_key_equals($php_values, 'install', 1)
+{
   if $::operatingsystem == 'ubuntu' {
     apt::key { '8D0DC64F':
       key_server => 'hkp://keyserver.ubuntu.com:80'
@@ -618,54 +866,27 @@ if (is_hash($xhprof_values) and has_key($xhprof_values, 'install') and $xhprof_v
     apt::ppa { 'ppa:brianmercer/php5-xhprof': require => Apt::Key['8D0DC64F'] }
   }
 
-  $xhprof_package = $puphpet::params::xhprof_package
-
-  if is_hash($apache_values) {
+  if hash_key_equals($apache_values, 'install', 1) {
     $xhprof_webroot_location = $puphpet::params::apache_webroot_location
-    $xhprof_webserver_service = Service['httpd']
-  } elsif is_hash($nginx_values) {
+    $xhprof_webserver_service = 'httpd'
+  } elsif hash_key_equals($nginx_values, 'install', 1) {
     $xhprof_webroot_location = $puphpet::params::nginx_webroot_location
-    $xhprof_webserver_service = Service['nginx']
+    $xhprof_webserver_service = 'nginx'
   } else {
     $xhprof_webroot_location = $xhprof_values['location']
     $xhprof_webserver_service = undef
   }
 
-  if defined(Package[$xhprof_package]) == false {
-    package { $xhprof_package:
-      ensure  => installed,
-      require => Package['php'],
-      notify  => $xhprof_webserver_service,
+  if ! defined(Package['graphviz']) {
+    package { 'graphviz':
+      ensure  => present,
     }
   }
 
-  ensure_packages( ['graphviz'] )
-
-  exec { 'delete-xhprof-path-if-not-git-repo':
-    command => "rm -rf ${xhprofPath}",
-    onlyif  => "test ! -d ${xhprofPath}/.git"
-  }
-
-  vcsrepo { "${xhprof_webroot_location}/xhprof":
-    ensure   => present,
-    provider => git,
-    source   => 'https://github.com/facebook/xhprof.git',
-    require  => Exec['delete-xhprof-path-if-not-git-repo']
-  }
-
-  file { "${xhprofPath}/xhprof_html":
-    ensure  => directory,
-    mode    => 0775,
-    require => Vcsrepo["${xhprof_webroot_location}/xhprof"]
-  }
-
-  composer::exec { 'xhprof-composer-run':
-    cmd     => 'install',
-    cwd     => "${xhprof_webroot_location}/xhprof",
-    require => [
-      Class['composer'],
-      File["${xhprofPath}/xhprof_html"]
-    ]
+  class { 'puphpet::xhprof':
+    php_version       => $php_values['version'],
+    webroot_location  => $xhprof_webroot_location,
+    webserver_service => $xhprof_webserver_service
   }
 }
 
@@ -675,7 +896,7 @@ if $drush_values == undef {
   $drush_values = hiera('drush', false)
 }
 
-if is_hash($drush_values) and has_key($drush_values, 'install') and $drush_values['install'] == 1 {
+if hash_key_equals($drush_values, 'install', 1) {
   if ($drush_values['settings']['drush.tag_branch'] != undef) {
     $drush_tag_branch = $drush_values['settings']['drush.tag_branch']
   } else {
@@ -689,52 +910,113 @@ if is_hash($drush_values) and has_key($drush_values, 'install') and $drush_value
 
 if $mysql_values == undef {
   $mysql_values = hiera('mysql', false)
-}
-
-if $php_values == undef {
+} if $php_values == undef {
   $php_values = hiera('php', false)
-}
-
-if $apache_values == undef {
+} if $apache_values == undef {
   $apache_values = hiera('apache', false)
-}
-
-if $nginx_values == undef {
+} if $nginx_values == undef {
   $nginx_values = hiera('nginx', false)
 }
 
-if is_hash($apache_values) or is_hash($nginx_values) {
-  $mysql_webserver_restart = true
-} else {
-  $mysql_webserver_restart = false
-}
+include 'mysql::params'
 
-if (is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1)
-  or (is_hash($hhvm_values) and has_key($hhvm_values, 'install') and $hhvm_values['install'] == 1)
-{
-  $mysql_php_installed = true
-} else {
-  $mysql_php_installed = false
-}
+if hash_key_equals($mysql_values, 'install', 1) {
+  if hash_key_equals($apache_values, 'install', 1) or hash_key_equals($nginx_values, 'install', 1) {
+    $mysql_webserver_restart = true
+  } else {
+    $mysql_webserver_restart = false
+  }
 
-if $mysql_values['root_password'] {
-  class { 'mysql::server':
-    root_password => $mysql_values['root_password'],
+  if $::osfamily == 'redhat' {
+    exec { 'mysql-community-repo':
+      command => 'yum -y --nogpgcheck install "http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm" && touch /.puphpet-stuff/mysql-community-release',
+      creates => '/.puphpet-stuff/mysql-community-release'
+    }
+
+    $mysql_server_require             = Exec['mysql-community-repo']
+    $mysql_server_server_package_name = 'mysql-community-server'
+    $mysql_server_client_package_name = 'mysql-community-client'
+  } else {
+    $mysql_server_require             = []
+    $mysql_server_server_package_name = $mysql::params::server_package_name
+    $mysql_server_client_package_name = $mysql::params::client_package_name
   }
 
-  if is_hash($mysql_values['databases']) and count($mysql_values['databases']) > 0 {
-    create_resources(mysql_db, $mysql_values['databases'])
+  if hash_key_equals($php_values, 'install', 1) {
+    $mysql_php_installed = true
+    $mysql_php_package   = 'php'
+  } elsif hash_key_equals($hhvm_values, 'install', 1) {
+    $mysql_php_installed = true
+    $mysql_php_package   = 'hhvm'
+  } else {
+    $mysql_php_installed = false
   }
 
-  if is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 and ! defined(Php::Pecl::Module[$mongodb_pecl]) {
-    if $::osfamily == 'redhat' and $php_values['version'] == '53' and ! defined(Php::Module['mysql']) {
-      php::module { 'mysql':
-        service_autorestart => $mysql_webserver_restart,
+  if $mysql_values['root_password'] {
+    class { 'mysql::server':
+      package_name  => $mysql_server_server_package_name,
+      root_password => $mysql_values['root_password'],
+      require       => $mysql_server_require
+    }
+
+    class { 'mysql::client':
+      package_name => $mysql_server_client_package_name,
+      require      => $mysql_server_require
+    }
+
+    if is_hash($mysql_values['databases']) and count($mysql_values['databases']) > 0 {
+      create_resources(mysql_db, $mysql_values['databases'])
+    }
+
+    if $mysql_php_installed and $mysql_php_package == 'php' {
+      if $::osfamily == 'redhat' and $php_values['version'] == '53' {
+        $mysql_php_module = 'mysql'
+      } elsif $lsbdistcodename == 'lucid' or $lsbdistcodename == 'squeeze' {
+        $mysql_php_module = 'mysql'
+      } else {
+        $mysql_php_module = 'mysqlnd'
+      }
+
+      if ! defined(Php::Module[$mysql_php_module]) {
+        php::module { $mysql_php_module:
+          service_autorestart => $mysql_webserver_restart,
+        }
       }
-    } elsif ! defined(Php::Module['mysqlnd']) {
-      php::module { 'mysqlnd':
-        service_autorestart => $mysql_webserver_restart,
+    }
+  }
+
+  if hash_key_equals($mysql_values, 'phpmyadmin', 1) and $mysql_php_installed {
+    if hash_key_equals($apache_values, 'install', 1) {
+      $mysql_pma_webroot_location = $puphpet::params::apache_webroot_location
+    } elsif hash_key_equals($nginx_values, 'install', 1) {
+      $mysql_pma_webroot_location = $puphpet::params::nginx_webroot_location
+
+      mysql_nginx_default_conf { 'override_default_conf':
+        webroot => $mysql_pma_webroot_location
       }
+    } else {
+      $mysql_pma_webroot_location = '/var/www'
+    }
+
+    class { 'puphpet::phpmyadmin':
+      dbms             => 'mysql::server',
+      webroot_location => $mysql_pma_webroot_location,
+    }
+  }
+
+  if hash_key_equals($mysql_values, 'adminer', 1) and $mysql_php_installed {
+    if hash_key_equals($apache_values, 'install', 1) {
+      $mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location
+    } elsif hash_key_equals($nginx_values, 'install', 1) {
+      $mysql_adminer_webroot_location = $puphpet::params::nginx_webroot_location
+    } else {
+      $mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location
+    }
+
+    class { 'puphpet::adminer':
+      location    => "${mysql_adminer_webroot_location}/adminer",
+      owner       => 'www-data',
+      php_package => $mysql_php_package
     }
   }
 }
@@ -759,65 +1041,252 @@ define mysql_db (
   }
 }
 
-if has_key($mysql_values, 'phpmyadmin') and $mysql_values['phpmyadmin'] == 1 and $mysql_php_installed {
-  if $::osfamily == 'debian' {
-    if $::operatingsystem == 'ubuntu' {
-      apt::key { '80E7349A06ED541C': key_server => 'hkp://keyserver.ubuntu.com:80' }
-      apt::ppa { 'ppa:nijel/phpmyadmin': require => Apt::Key['80E7349A06ED541C'] }
+# @todo update this
+define mysql_nginx_default_conf (
+  $webroot
+) {
+  if $php5_fpm_sock == undef {
+    $php5_fpm_sock = '/var/run/php5-fpm.sock'
+  }
+
+  if $fastcgi_pass == undef {
+    $fastcgi_pass = $php_values['version'] ? {
+      undef   => null,
+      '53'    => '127.0.0.1:9000',
+      default => "unix:${php5_fpm_sock}"
     }
+  }
 
-    $phpMyAdmin_package = 'phpmyadmin'
-    $phpMyAdmin_folder = 'phpmyadmin'
-  } elsif $::osfamily == 'redhat' {
-    $phpMyAdmin_package = 'phpMyAdmin.noarch'
-    $phpMyAdmin_folder = 'phpMyAdmin'
+  class { 'puphpet::nginx':
+    fastcgi_pass => $fastcgi_pass,
+    notify       => Class['nginx::service'],
   }
+}
 
-  if ! defined(Package[$phpMyAdmin_package]) {
-    package { $phpMyAdmin_package:
-      require => Class['mysql::server']
-    }
+## Begin PostgreSQL manifest
+
+if $postgresql_values == undef {
+  $postgresql_values = hiera('postgresql', false)
+} if $php_values == undef {
+  $php_values = hiera('php', false)
+} if $hhvm_values == undef {
+  $hhvm_values = hiera('hhvm', false)
+}
+
+if hash_key_equals($postgresql_values, 'install', 1) {
+  if hash_key_equals($apache_values, 'install', 1) or hash_key_equals($nginx_values, 'install', 1) {
+    $postgresql_webserver_restart = true
+  } else {
+    $postgresql_webserver_restart = false
   }
 
-  include puphpet::params
+  if hash_key_equals($php_values, 'install', 1) {
+    $postgresql_php_installed = true
+    $postgresql_php_package   = 'php'
+  } elsif hash_key_equals($hhvm_values, 'install', 1) {
+    $postgresql_php_installed = true
+    $postgresql_php_package   = 'hhvm'
+  } else {
+    $postgresql_php_installed = false
+  }
+
+  if $postgresql_values['settings']['root_password'] {
+    group { $postgresql_values['settings']['user_group']:
+      ensure => present
+    }
+
+    class { 'postgresql::globals':
+      manage_package_repo => true,
+      encoding            => $postgresql_values['settings']['encoding'],
+      version             => $postgresql_values['settings']['version']
+    }->
+    class { 'postgresql::server':
+      postgres_password => $postgresql_values['settings']['root_password'],
+      version           => $postgresql_values['settings']['version'],
+      require           => Group[$postgresql_values['settings']['user_group']]
+    }
 
-  if is_hash($apache_values) {
-    $mysql_pma_webroot_location = $puphpet::params::apache_webroot_location
-  } elsif is_hash($nginx_values) {
-    $mysql_pma_webroot_location = $puphpet::params::nginx_webroot_location
+    if is_hash($postgresql_values['databases']) and count($postgresql_values['databases']) > 0 {
+      create_resources(postgresql_db, $postgresql_values['databases'])
+    }
 
-    mysql_nginx_default_conf { 'override_default_conf':
-      webroot => $mysql_pma_webroot_location
+    if $postgresql_php_installed and $postgresql_php_package == 'php' and ! defined(Php::Module['pgsql']) {
+      php::module { 'pgsql':
+        service_autorestart => $postgresql_webserver_restart,
+      }
     }
   }
 
-  exec { 'cp phpmyadmin to webroot':
-    command => "cp -LR /usr/share/${phpMyAdmin_folder} ${mysql_pma_webroot_location}/phpmyadmin",
-    onlyif  => "test ! -d ${mysql_pma_webroot_location}/phpmyadmin",
-    require => [
-      Package[$phpMyAdmin_package],
-      File[$mysql_pma_webroot_location]
-    ]
+  if hash_key_equals($postgresql_values, 'adminer', 1) and $postgresql_php_installed {
+    if hash_key_equals($apache_values, 'install', 1) {
+      $postgresql_adminer_webroot_location = $puphpet::params::apache_webroot_location
+    } elsif hash_key_equals($nginx_values, 'install', 1) {
+      $postgresql_adminer_webroot_location = $puphpet::params::nginx_webroot_location
+    } else {
+      $postgresql_adminer_webroot_location = $puphpet::params::apache_webroot_location
+    }
+
+    class { 'puphpet::adminer':
+      location    => "${postgresql_adminer_webroot_location}/adminer",
+      owner       => 'www-data',
+      php_package => $postgresql_php_package
+    }
+  }
+}
+
+define postgresql_db (
+  $user,
+  $password,
+  $grant,
+  $sql_file = false
+) {
+  if $name == '' or $user == '' or $password == '' or $grant == '' {
+    fail( 'PostgreSQL DB requires that name, user, password and grant be set. Please check your settings!' )
+  }
+
+  postgresql::server::db { $name:
+    user     => $user,
+    password => $password,
+    grant    => $grant
+  }
+
+  if $sql_file {
+    $table = "${name}.*"
+
+    exec{ "${name}-import":
+      command     => "psql ${name} < ${sql_file}",
+      logoutput   => true,
+      refreshonly => $refresh,
+      require     => Postgresql::Server::Db[$name],
+      onlyif      => "test -f ${sql_file}"
+    }
   }
 }
 
-if has_key($mysql_values, 'adminer') and $mysql_values['adminer'] == 1 and $mysql_php_installed {
-  if is_hash($apache_values) {
-    $mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location
-  } elsif is_hash($nginx_values) {
-    $mysql_adminer_webroot_location = $puphpet::params::nginx_webroot_location
+## Begin MariaDb manifest
+
+if $mariadb_values == undef {
+  $mariadb_values = hiera('mariadb', false)
+} if $php_values == undef {
+  $php_values = hiera('php', false)
+} if $hhvm_values == undef {
+  $hhvm_values = hiera('hhvm', false)
+} if $apache_values == undef {
+  $apache_values = hiera('apache', false)
+} if $nginx_values == undef {
+  $nginx_values = hiera('nginx', false)
+}
+
+if hash_key_equals($mariadb_values, 'install', 1) {
+  if hash_key_equals($apache_values, 'install', 1) or hash_key_equals($nginx_values, 'install', 1) {
+    $mariadb_webserver_restart = true
   } else {
-    $mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location
+    $mariadb_webserver_restart = false
   }
 
-  class { 'puphpet::adminer':
-    location => "${mysql_adminer_webroot_location}/adminer",
-    owner    => 'www-data'
+  if hash_key_equals($php_values, 'install', 1) {
+    $mariadb_php_installed = true
+    $mariadb_php_package   = 'php'
+  } elsif hash_key_equals($hhvm_values, 'install', 1) {
+    $mariadb_php_installed = true
+    $mariadb_php_package   = 'hhvm'
+  } else {
+    $mariadb_php_installed = false
+  }
+
+  if has_key($mariadb_values, 'root_password') and $mariadb_values['root_password'] {
+    class { 'puphpet::mariadb':
+      version => $mariadb_values['version']
+    }
+
+    class { 'mysql::server':
+      package_name  => $puphpet::params::mariadb_package_server_name,
+      root_password => $mariadb_values['root_password']
+    }
+
+    class { 'mysql::client':
+      package_name => $puphpet::params::mariadb_package_client_name
+    }
+
+    if is_hash($mariadb_values['databases']) and count($mariadb_values['databases']) > 0 {
+      create_resources(mariadb_db, $mariadb_values['databases'])
+    }
+
+    if $mariadb_php_installed and $mariadb_php_package == 'php' {
+      if $::osfamily == 'redhat' and $php_values['version'] == '53' {
+        $mariadb_php_module = 'mysql'
+      } elsif $lsbdistcodename == 'lucid' or $lsbdistcodename == 'squeeze' {
+        $mariadb_php_module = 'mysql'
+      } else {
+        $mariadb_php_module = 'mysqlnd'
+      }
+
+      if ! defined(Php::Module[$mariadb_php_module]) {
+        php::module { $mariadb_php_module:
+          service_autorestart => $mariadb_webserver_restart,
+        }
+      }
+    }
+  }
+
+  if hash_key_equals($mariadb_values, 'phpmyadmin', 1) and $mariadb_php_installed {
+    if hash_key_equals($apache_values, 'install', 1) {
+      $mariadb_pma_webroot_location = $puphpet::params::apache_webroot_location
+    } elsif hash_key_equals($nginx_values, 'install', 1) {
+      $mariadb_pma_webroot_location = $puphpet::params::nginx_webroot_location
+
+      mariadb_nginx_default_conf { 'override_default_conf':
+        webroot => $mariadb_pma_webroot_location
+      }
+    } else {
+      $mariadb_pma_webroot_location = '/var/www'
+    }
+
+    class { 'puphpet::phpmyadmin':
+      dbms             => 'mysql::server',
+      webroot_location => $mariadb_pma_webroot_location,
+    }
+  }
+
+  if hash_key_equals($mariadb_values, 'adminer', 1) and $mariadb_php_installed {
+    if hash_key_equals($apache_values, 'install', 1) {
+      $mariadb_adminer_webroot_location = $puphpet::params::apache_webroot_location
+    } elsif hash_key_equals($nginx_values, 'install', 1) {
+      $mariadb_adminer_webroot_location = $puphpet::params::nginx_webroot_location
+    } else {
+      $mariadb_adminer_webroot_location = $puphpet::params::apache_webroot_location
+    }
+
+    class { 'puphpet::adminer':
+      location    => "${mariadb_adminer_webroot_location}/adminer",
+      owner       => 'www-data',
+      php_package => $mariadb_php_package
+    }
   }
 }
 
-# @todo update this
-define mysql_nginx_default_conf (
+define mariadb_db (
+  $user,
+  $password,
+  $host,
+  $grant    = [],
+  $sql_file = false
+) {
+  if $name == '' or $password == '' or $host == '' {
+    fail( 'MariaDB requires that name, password and host be set. Please check your settings!' )
+  }
+
+  mysql::db { $name:
+    user     => $user,
+    password => $password,
+    host     => $host,
+    grant    => $grant,
+    sql      => $sql_file,
+  }
+}
+
+# @todo update this!
+define mariadb_nginx_default_conf (
   $webroot
 ) {
   if $php5_fpm_sock == undef {
@@ -842,48 +1311,39 @@ define mysql_nginx_default_conf (
 
 if $mongodb_values == undef {
   $mongodb_values = hiera('mongodb', false)
-}
-
-if $php_values == undef {
+} if $php_values == undef {
   $php_values = hiera('php', false)
-}
-
-if $apache_values == undef {
+} if $apache_values == undef {
   $apache_values = hiera('apache', false)
-}
-
-if $nginx_values == undef {
+} if $nginx_values == undef {
   $nginx_values = hiera('nginx', false)
 }
 
-if is_hash($apache_values) or is_hash($nginx_values) {
+if hash_key_equals($apache_values, 'install', 1)
+  or hash_key_equals($nginx_values, 'install', 1)
+{
   $mongodb_webserver_restart = true
 } else {
   $mongodb_webserver_restart = false
 }
 
-if has_key($mongodb_values, 'install') and $mongodb_values['install'] == 1 {
+if hash_key_equals($mongodb_values, 'install', 1) {
+  Class['Mongodb::Globals'] -> Class['Mongodb::Server']
+
+  class { 'mongodb::globals':
+    manage_package_repo => true,
+  }
+
+  create_resources('class', { 'mongodb::server' => $mongodb_values['settings'] })
+
   case $::osfamily {
     'debian': {
-      class {'::mongodb::globals':
-        manage_package_repo => true,
-      }->
-      class {'::mongodb::server':
-        auth => $mongodb_values['auth'],
-        port => $mongodb_values['port'],
-      }
-
       $mongodb_pecl = 'mongo'
     }
     'redhat': {
-      class {'::mongodb::globals':
-        manage_package_repo => true,
-      }->
-      class {'::mongodb::server':
-        auth => $mongodb_values['auth'],
-        port => $mongodb_values['port'],
-      }->
-      class {'::mongodb::client': }
+      class { '::mongodb::client':
+        require => Class['::Mongodb::Server']
+      }
 
       $mongodb_pecl = 'pecl-mongo'
     }
@@ -893,10 +1353,13 @@ if has_key($mongodb_values, 'install') and $mongodb_values['install'] == 1 {
     create_resources(mongodb_db, $mongodb_values['databases'])
   }
 
-  if is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 and ! defined(Php::Pecl::Module[$mongodb_pecl]) {
+  if hash_key_equals($php_values, 'install', 1)
+    and ! defined(Php::Pecl::Module[$mongodb_pecl])
+  {
     php::pecl::module { $mongodb_pecl:
-      service_autorestart => $mariadb_webserver_restart,
-      require             => Class['::mongodb::server']
+      use_package         => false,
+      service_autorestart => $mongodb_webserver_restart,
+      require             => Class['mongodb::server']
     }
   }
 }
@@ -915,48 +1378,73 @@ define mongodb_db (
   }
 }
 
-# Begin beanstalkd
+# Begin redis
 
-if $beanstalkd_values == undef {
-  $beanstalkd_values = hiera('beanstalkd', false)
-}
-
-if $php_values == undef {
+if $redis_values == undef {
+  $redis_values = hiera('redis', false)
+} if $php_values == undef {
   $php_values = hiera('php', false)
+} if $apache_values == undef {
+  $apache_values = hiera('apache', false)
+} if $nginx_values == undef {
+  $nginx_values = hiera('nginx', false)
 }
 
-if $hhvm_values == undef {
-  $hhvm_values = hiera('hhvm', false)
+if hash_key_equals($apache_values, 'install', 1)
+  or hash_key_equals($nginx_values, 'install', 1)
+{
+  $redis_webserver_restart = true
+} else {
+  $redis_webserver_restart = false
 }
 
-if $apache_values == undef {
-  $apache_values = hiera('apache', false)
+if hash_key_equals($redis_values, 'install', 1) {
+  create_resources('class', { 'redis' => $redis_values['settings'] })
+
+  if hash_key_equals($php_values, 'install', 1) and ! defined(Php::Pecl::Module['redis']) {
+    php::pecl::module { 'redis':
+      use_package         => false,
+      service_autorestart => $redis_webserver_restart,
+      require             => Class['redis']
+    }
+  }
 }
 
-if $nginx_values == undef {
+# Begin beanstalkd
+
+if $beanstalkd_values == undef {
+  $beanstalkd_values = hiera('beanstalkd', false)
+} if $php_values == undef {
+  $php_values = hiera('php', false)
+} if $hhvm_values == undef {
+  $hhvm_values = hiera('hhvm', false)
+} if $apache_values == undef {
+  $apache_values = hiera('apache', false)
+} if $nginx_values == undef {
   $nginx_values = hiera('nginx', false)
 }
 
-if is_hash($apache_values) {
+if hash_key_equals($apache_values, 'install', 1) {
   $beanstalk_console_webroot_location = "${puphpet::params::apache_webroot_location}/beanstalk_console"
-} elsif is_hash($nginx_values) {
+} elsif hash_key_equals($nginx_values, 'install', 1) {
   $beanstalk_console_webroot_location = "${puphpet::params::nginx_webroot_location}/beanstalk_console"
 } else {
   $beanstalk_console_webroot_location = undef
 }
 
-if (is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1)
-  or (is_hash($hhvm_values) and has_key($hhvm_values, 'install') and $hhvm_values['install'] == 1)
-{
+if hash_key_equals($php_values, 'install', 1) or hash_key_equals($hhvm_values, 'install', 1) {
   $beanstalkd_php_installed = true
 } else {
   $beanstalkd_php_installed = false
 }
 
-if is_hash($beanstalkd_values) and has_key($beanstalkd_values, 'install') and $beanstalkd_values['install'] == 1 {
-  create_resources(beanstalkd::config, {'beanstalkd' => $beanstalkd_values['settings']})
+if hash_key_equals($beanstalkd_values, 'install', 1) {
+  create_resources(beanstalkd::config, { 'beanstalkd' => $beanstalkd_values['settings'] })
 
-  if has_key($beanstalkd_values, 'beanstalk_console') and $beanstalkd_values['beanstalk_console'] == 1 and $beanstalk_console_webroot_location != undef and $beanstalkd_php_installed {
+  if hash_key_equals($beanstalkd_values, 'beanstalk_console', 1)
+    and $beanstalk_console_webroot_location != undef
+    and $beanstalkd_php_installed
+  {
     exec { 'delete-beanstalk_console-path-if-not-git-repo':
       command => "rm -rf ${beanstalk_console_webroot_location}",
       onlyif  => "test ! -d ${beanstalk_console_webroot_location}/.git"
@@ -968,6 +1456,13 @@ if is_hash($beanstalkd_values) and has_key($beanstalkd_values, 'install') and $b
       source   => 'https://github.com/ptrofimov/beanstalk_console.git',
       require  => Exec['delete-beanstalk_console-path-if-not-git-repo']
     }
+
+    file { "${beanstalk_console_webroot_location}/storage.json":
+      ensure  => present,
+      group   => 'www-data',
+      mode    => 0775,
+      require => Vcsrepo[$beanstalk_console_webroot_location]
+    }
   }
 }
 
@@ -975,19 +1470,31 @@ if is_hash($beanstalkd_values) and has_key($beanstalkd_values, 'install') and $b
 
 if $rabbitmq_values == undef {
   $rabbitmq_values = hiera('rabbitmq', false)
+} if $php_values == undef {
+  $php_values = hiera('php', false)
+} if $apache_values == undef {
+  $apache_values = hiera('apache', false)
+} if $nginx_values == undef {
+  $nginx_values = hiera('nginx', false)
 }
 
-if $php_values == undef {
-  $php_values = hiera('php', false)
+if hash_key_equals($apache_values, 'install', 1)
+  or hash_key_equals($nginx_values, 'install', 1)
+{
+  $rabbitmq_webserver_restart = true
+} else {
+  $rabbitmq_webserver_restart = false
 }
 
-if has_key($rabbitmq_values, 'install') and $rabbitmq_values['install'] == 1 {
-  class { 'rabbitmq':
-    port => $rabbitmq_values['port']
-  }
+if hash_key_equals($rabbitmq_values, 'install', 1) {
+  create_resources('class', { 'rabbitmq' => $rabbitmq_values['settings'] })
 
-  if is_hash($php_values) and has_key($php_values, 'install') and $php_values['install'] == 1 and ! defined(Php::Pecl::Module['amqp']) {
-    php_pecl_mod { 'amqp': }
+  if hash_key_equals($php_values, 'install', 1) and ! defined(Php::Pecl::Module['amqp']) {
+    php::pecl::module { 'amqp':
+      use_package         => false,
+      service_autorestart => $rabbitmq_webserver_restart,
+      require             => Class['rabbitmq']
+    }
   }
 }
 
diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh b/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh
index 6cb58597fd5da287c2f39c32681a17757a239cc1..e53884b9a76ac3e35946d784d349684d21dbf98f 100644
--- a/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh
+++ b/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+export DEBIAN_FRONTEND=noninteractive
+
 VAGRANT_CORE_FOLDER=$(cat "/.puphpet-stuff/vagrant-core-folder.txt")
 
 shopt -s nullglob
@@ -7,12 +9,12 @@ files=("${VAGRANT_CORE_FOLDER}"/files/exec-once/*)
 
 if [[ ! -f /.puphpet-stuff/exec-once-ran && (${#files[@]} -gt 0) ]]; then
     echo 'Running files in files/exec-once'
-    find "${VAGRANT_CORE_FOLDER}/files/exec-once" -maxdepth 1 -type f \( ! -iname "empty" \) -exec chmod +x '{}' \; -exec {} \;
+    find "${VAGRANT_CORE_FOLDER}/files/exec-once" -maxdepth 1 -not -path '*/\.*' -type f \( ! -iname "empty" \) -exec chmod +x '{}' \; -exec {} \;
     echo 'Finished running files in files/exec-once'
     echo 'To run again, delete file /.puphpet-stuff/exec-once-ran'
     touch /.puphpet-stuff/exec-once-ran
 fi
 
 echo 'Running files in files/exec-always'
-find "${VAGRANT_CORE_FOLDER}/files/exec-always" -maxdepth 1 -type f \( ! -iname "empty" \) -exec chmod +x '{}' \; -exec {} \;
+find "${VAGRANT_CORE_FOLDER}/files/exec-always" -maxdepth 1 -not -path '*/\.*' -type f \( ! -iname "empty" \) -exec chmod +x '{}' \; -exec {} \;
 echo 'Finished running files in files/exec-always'
diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh b/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh
index b6fb27aa6b844e5fc5a3d8ea4004e991fac07df3..47e336ddf5876bc217ecc54e8136c636ead6d8f1 100644
--- a/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh
+++ b/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+export DEBIAN_FRONTEND=noninteractive
+
 VAGRANT_CORE_FOLDER=$(echo "$1")
 
 OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID)
@@ -22,16 +24,26 @@ if [[ ! -f /.puphpet-stuff/initial-setup-repo-update ]]; then
         echo "Finished running initial-setup apt-get update"
     elif [[ "${OS}" == 'centos' ]]; then
         echo "Running initial-setup yum update"
-        yum install yum-plugin-fastestmirror -y >/dev/null
-        yum check-update -y >/dev/null
+        yum -y --nogpgcheck install "http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm" >/dev/null
+        yum -y --nogpgcheck install "https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm" >/dev/null
+        yum -y install centos-release-SCL yum-plugin-fastestmirror >/dev/null
+        yum -y check-update >/dev/null
         echo "Finished running initial-setup yum update"
 
         echo "Updating to Ruby 1.9.3"
-        yum install centos-release-SCL >/dev/null
+        yum -y install centos-release-SCL >/dev/null
         yum remove ruby >/dev/null
-        yum install ruby193 facter hiera ruby193-ruby-irb ruby193-ruby-doc ruby193-rubygem-json ruby193-libyaml >/dev/null
+        yum -y install ruby193 ruby193-ruby-irb ruby193-ruby-doc ruby193-libyaml rubygems >/dev/null
+        yum -y --nogpgcheck install "https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-rgen-0.6.5-2.el6.noarch.rpm" >/dev/null
         gem update --system >/dev/null
         gem install haml >/dev/null
+
+        yum -y --nogpgcheck install "https://yum.puppetlabs.com/el/6/products/x86_64/hiera-1.3.2-1.el6.noarch.rpm" >/dev/null
+        yum -y --nogpgcheck install "https://yum.puppetlabs.com/el/6/products/x86_64/facter-1.7.5-1.el6.x86_64.rpm" >/dev/null
+        yum -y --nogpgcheck install "https://yum.puppetlabs.com/el/6/dependencies/x86_64/rubygem-json-1.5.5-1.el6.x86_64.rpm" >/dev/null
+        yum -y --nogpgcheck install "https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-json-1.5.5-1.el6.x86_64.rpm" >/dev/null
+        yum -y --nogpgcheck install "https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-shadow-2.2.0-2.el6.x86_64.rpm" >/dev/null
+        yum -y --nogpgcheck install "https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-augeas-0.4.1-3.el6.x86_64.rpm" >/dev/null
         echo "Finished updating to Ruby 1.9.3"
 
         echo "Installing basic development tools (CentOS)"
diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh b/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh
index a521f442798b9c1bffdd3187bab1c2f6eea158bb..61e99892dfd806d8bcaf2832e0a214e7c13b8938 100644
--- a/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh
+++ b/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
- 
+
 # Try and get debian operating system
 # id, codename, and release
 
@@ -40,9 +40,9 @@ info[id]=$(echo "${ID}" | tr '[A-Z]' '[a-z]')
 info[codename]=$(echo "${CODENAME}" | tr '[A-Z]' '[a-z]')
 info[release]=$(echo "${RELEASE}" | tr '[A-Z]' '[a-z]')
 
-if [ "$TYPE" ] ; then 
+if [ "$TYPE" ] ; then
     echo "${info[${TYPE}]}"
-else 
+else
     echo -e "ID\t${info[id]}"
     echo -e "CODENAME\t${info[codename]}"
     echo -e "RELEASE\t${info[release]}"
diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/librarian-puppet-vagrant.sh b/dev/vagrant/dolibarrdev/puphpet/shell/r10k.sh
similarity index 50%
rename from dev/vagrant/dolibarrdev/puphpet/shell/librarian-puppet-vagrant.sh
rename to dev/vagrant/dolibarrdev/puphpet/shell/r10k.sh
index 9c4dc8af2383468ee7609f5e9d5d50d6428a1444..7f9892c570a797f6efdd4b778f1f3e670e06e24d 100644
--- a/dev/vagrant/dolibarrdev/puphpet/shell/librarian-puppet-vagrant.sh
+++ b/dev/vagrant/dolibarrdev/puphpet/shell/r10k.sh
@@ -1,17 +1,19 @@
 #!/bin/bash
 
+export DEBIAN_FRONTEND=noninteractive
+
 VAGRANT_CORE_FOLDER=$(cat "/.puphpet-stuff/vagrant-core-folder.txt")
 
 OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID)
 CODENAME=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" CODENAME)
 
-# Directory in which librarian-puppet should manage its modules directory
+# Directory in which r10k should manage its modules directory
 PUPPET_DIR=/etc/puppet/
 
 $(which git > /dev/null 2>&1)
 FOUND_GIT=$?
 
-if [ "${FOUND_GIT}" -ne '0' ] && [ ! -f /.puphpet-stuff/librarian-puppet-installed ]; then
+if [ "${FOUND_GIT}" -ne '0' ] && [ ! -f /.puphpet-stuff/r10k-installed ]; then
     $(which apt-get > /dev/null 2>&1)
     FOUND_APT=$?
     $(which yum > /dev/null 2>&1)
@@ -38,52 +40,48 @@ cp "${VAGRANT_CORE_FOLDER}/puppet/Puppetfile" "${PUPPET_DIR}"
 echo "Copied Puppetfile"
 
 if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then
-    if [[ ! -f /.puphpet-stuff/librarian-base-packages ]]; then
-        echo 'Installing base packages for librarian'
+    if [[ ! -f /.puphpet-stuff/r10k-base-packages ]]; then
+        echo 'Installing base packages for r10k'
         apt-get install -y build-essential ruby-dev >/dev/null
-        echo 'Finished installing base packages for librarian'
+        gem install json >/dev/null
+        echo 'Finished installing base packages for r10k'
 
-        touch /.puphpet-stuff/librarian-base-packages
+        touch /.puphpet-stuff/r10k-base-packages
     fi
 fi
 
 if [ "${OS}" == 'ubuntu' ]; then
-    if [[ ! -f /.puphpet-stuff/librarian-libgemplugin-ruby ]]; then
+    if [[ ! -f /.puphpet-stuff/r10k-libgemplugin-ruby ]]; then
         echo 'Updating libgemplugin-ruby (Ubuntu only)'
         apt-get install -y libgemplugin-ruby >/dev/null
         echo 'Finished updating libgemplugin-ruby (Ubuntu only)'
 
-        touch /.puphpet-stuff/librarian-libgemplugin-ruby
+        touch /.puphpet-stuff/r10k-libgemplugin-ruby
     fi
 
-    if [ "${CODENAME}" == 'lucid' ] && [ ! -f /.puphpet-stuff/librarian-rubygems-update ]; then
+    if [ "${CODENAME}" == 'lucid' ] && [ ! -f /.puphpet-stuff/r10k-rubygems-update ]; then
         echo 'Updating rubygems (Ubuntu Lucid only)'
         echo 'Ignore all "conflicting chdir" errors!'
         gem install rubygems-update >/dev/null
         /var/lib/gems/1.8/bin/update_rubygems >/dev/null
         echo 'Finished updating rubygems (Ubuntu Lucid only)'
 
-        touch /.puphpet-stuff/librarian-rubygems-update
+        touch /.puphpet-stuff/r10k-rubygems-update
     fi
 fi
 
-if [[ ! -f /.puphpet-stuff/librarian-puppet-installed ]]; then
-    echo 'Installing librarian-puppet'
-    gem install librarian-puppet >/dev/null
-    echo 'Finished installing librarian-puppet'
+if [[ ! -f /.puphpet-stuff/r10k-puppet-installed ]]; then
+    echo 'Installing r10k'
+    gem install r10k >/dev/null
+    echo 'Finished installing r10k'
 
-    echo 'Running initial librarian-puppet'
-    cd "${PUPPET_DIR}" && librarian-puppet install --clean >/dev/null
-    echo 'Finished running initial librarian-puppet'
+    echo 'Running initial r10k'
+    cd "${PUPPET_DIR}" && r10k puppetfile install >/dev/null
+    echo 'Finished running initial r10k'
 
-    touch /.puphpet-stuff/librarian-puppet-installed
+    touch /.puphpet-stuff/r10k-puppet-installed
 else
-    echo 'Running update librarian-puppet'
-    cd "${PUPPET_DIR}" && librarian-puppet update >/dev/null
-    echo 'Finished running update librarian-puppet'
+    echo 'Running update r10k'
+    cd "${PUPPET_DIR}" && r10k puppetfile install >/dev/null
+    echo 'Finished running update r10k'
 fi
-
-echo "Replacing puppetlabs-git module with custom"
-rm -rf /etc/puppet/modules/git
-git clone https://github.com/puphpet/puppetlabs-git.git /etc/puppet/modules/git
-echo "Finished replacing puppetlabs-git module with custom"
diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/ssh-keygen.sh b/dev/vagrant/dolibarrdev/puphpet/shell/ssh-keygen.sh
new file mode 100644
index 0000000000000000000000000000000000000000..65b47a00ea8eea747dbc3cf6d9176b704ea742de
--- /dev/null
+++ b/dev/vagrant/dolibarrdev/puphpet/shell/ssh-keygen.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+VAGRANT_CORE_FOLDER=$(cat "/.puphpet-stuff/vagrant-core-folder.txt")
+
+VAGRANT_SSH_USERNAME=$(echo "$1")
+
+if [[ ! -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa" ]]; then
+    echo "Creating new SSH key at ${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa"
+    ssh-keygen -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa" -P ""
+fi
+
+echo "Adding generated key to /root/.ssh/authorized_keys"
+mkdir -p /root/.ssh
+cat "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" > "/root/.ssh/authorized_keys"
+chmod 600 "/root/.ssh/authorized_keys"
+
+if [ "${VAGRANT_SSH_USERNAME}" != 'root' ]; then
+    VAGRANT_SSH_FOLDER="/home/${VAGRANT_SSH_USERNAME}/.ssh";
+
+    echo "Adding generated key to ${VAGRANT_SSH_FOLDER}/authorized_keys"
+    cat "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" > "${VAGRANT_SSH_FOLDER}/authorized_keys"
+    chown "${VAGRANT_SSH_USERNAME}" "${VAGRANT_SSH_FOLDER}/authorized_keys"
+    chgrp "${VAGRANT_SSH_USERNAME}" "${VAGRANT_SSH_FOLDER}/authorized_keys"
+    chmod 600 "${VAGRANT_SSH_FOLDER}/authorized_keys"
+fi
+
+passwd -d vagrant >/dev/null
diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/update-puppet.sh b/dev/vagrant/dolibarrdev/puphpet/shell/update-puppet.sh
index 13eb88d48708330ef329aa0470095c50c6487c7b..02c576df792be1311080f7493335a091533cc5a8 100644
--- a/dev/vagrant/dolibarrdev/puphpet/shell/update-puppet.sh
+++ b/dev/vagrant/dolibarrdev/puphpet/shell/update-puppet.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+export DEBIAN_FRONTEND=noninteractive
+
 VAGRANT_CORE_FOLDER=$(cat "/.puphpet-stuff/vagrant-core-folder.txt")
 
 OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID)
@@ -18,26 +20,22 @@ if [[ ! -f /.puphpet-stuff/update-puppet ]]; then
         apt-get update >/dev/null
         echo "Finished running update-puppet apt-get update"
 
-        echo "Updating Puppet to latest version"
-        apt-get -y install puppet >/dev/null
+        echo "Updating Puppet to version 3.4.x"
+        apt-get install -y puppet=3.4.3-1puppetlabs1 puppet-common=3.4.3-1puppetlabs1 >/dev/null
         PUPPET_VERSION=$(puppet help | grep 'Puppet v')
         echo "Finished updating puppet to latest version: ${PUPPET_VERSION}"
 
         touch /.puphpet-stuff/update-puppet
         echo "Created empty file /.puphpet-stuff/update-puppet"
     elif [ "${OS}" == 'centos' ]; then
-        echo "Downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppetlabs-release-6-7.noarch.rpm"
-        yum -y --nogpgcheck install "http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppetlabs-release-6-7.noarch.rpm" >/dev/null
-        echo "Finished downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppetlabs-release-6-7.noarch.rpm"
-
-        echo "Running update-puppet yum update"
-        yum -y update >/dev/null
-        echo "Finished running update-puppet yum update"
+        echo "Downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm"
+        yum -y --nogpgcheck install "http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm" >/dev/null
+        echo "Finished downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm"
 
-        echo "Installing/Updating Puppet to latest version"
+        echo "Installing/Updating Puppet to version 3.4.x"
         yum -y install puppet >/dev/null
         PUPPET_VERSION=$(puppet help | grep 'Puppet v')
-        echo "Finished installing/updating puppet to latest version: ${PUPPET_VERSION}"
+        echo "Finished installing/updating puppet to version: ${PUPPET_VERSION}"
 
         touch /.puphpet-stuff/update-puppet
         echo "Created empty file /.puphpet-stuff/update-puppet"