diff options
-rw-r--r-- | manifests/init.pp | 17 | ||||
-rw-r--r-- | templates/settings.json.erb | 4 |
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 } }, |