]> gitweb.fluxo.info Git - puppet-etherpad.git/commitdiff
Switching to parametrized class and hiera
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 27 Jan 2013 18:34:59 +0000 (16:34 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 27 Jan 2013 18:34:59 +0000 (16:34 -0200)
manifests/init.pp
templates/settings.json.erb

index ac7ccdd8b4294a3fcf341961983ceb17c4137498..f8b199bd2f0376fdec7a280d82fd7b9711bc3ee4 100644 (file)
@@ -1,6 +1,11 @@
-class etherpad {
-  case $etherpad_db_password {
-    '': { fail("You need to define etherpad database password! Please set \$etherpad_db_password in your site.pp or host config") }
+class etherpad(
+  $db_password    = hiera('etherpad::db_password', ''),
+  $admin_password = hiera('etherpadd::admin_password', ''),
+  $api_key        = hiera('etherpad::api_key, '')
+) {
+
+  case $db_password {
+    '': { fail("You need to define etherpad database password! Please set etherpadd::db_password in your config") }
   }
 
   mysql_database { 'etherpad':
@@ -9,7 +14,7 @@ class etherpad {
 
   mysql_user { "etherpad@%":
     ensure        => present,
-    password_hash => mysql_password($etherpad_db_password),
+    password_hash => mysql_password($db_password),
     require       => Mysql_database['etherpad'],
   }
 
@@ -88,13 +93,13 @@ class etherpad {
     notify  => Service['etherpad-lite'],
   }
 
-  if $etherpad_api_key != '' {
+  if $api_key != '' {
     file { '/var/lib/etherpad-lite/APIKEY.txt':
       ensure  => present,
       owner   => 'etherpad-lite',
       group   => 'etherpad-lite',
       mode    => 0640,
-      content => "$etherpad_api_key",
+      content => "${api_key}",
       require => Vcsrepo['/var/lib/etherpad-lite'],
       notify  => Service['etherpad-lite'],
     }
index 45e60170f0e05e827cb761833e1df994d9eca1aa..ee538a0ad94d3778c4c09c8db3371dd01790624f 100644 (file)
@@ -21,7 +21,7 @@
   "dbSettings" : {
                     "user"    : "etherpad", 
                     "host"    : "localhost", 
-                    "password": "<%= etherpad_db_password %>", 
+                    "password": "<%= db_password %>", 
                     "database": "etherpad"
                   },
 
@@ -69,7 +69,7 @@
   */
   "users": {
     "admin": {
-      "password": "<%= etherpad_admin_password %>",
+      "password": "<%= admin_password %>",
       "is_admin": true
     }
   },