summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-27 16:34:59 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-27 16:34:59 -0200
commit4d338f410af8d2e3d0431ea8c30968bdaf7278f2 (patch)
tree14824d47ff40176a0918cb992c5718b2ff7d77bc
parentdc3ae9c0b0d788862fe6959cddea1a6a8b091cce (diff)
downloadpuppet-etherpad-4d338f410af8d2e3d0431ea8c30968bdaf7278f2.tar.gz
puppet-etherpad-4d338f410af8d2e3d0431ea8c30968bdaf7278f2.tar.bz2
Switching to parametrized class and hiera
-rw-r--r--manifests/init.pp17
-rw-r--r--templates/settings.json.erb4
2 files changed, 13 insertions, 8 deletions
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'],
}
diff --git a/templates/settings.json.erb b/templates/settings.json.erb
index 45e6017..ee538a0 100644
--- a/templates/settings.json.erb
+++ b/templates/settings.json.erb
@@ -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
}
},