From 4d338f410af8d2e3d0431ea8c30968bdaf7278f2 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 27 Jan 2013 16:34:59 -0200 Subject: Switching to parametrized class and hiera --- manifests/init.pp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index ac7ccdd..f8b199b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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'], } -- cgit v1.2.3