summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp66
1 files changed, 20 insertions, 46 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 9dee680..f7630c1 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,8 +1,7 @@
class etherpad(
$db_password = hiera('etherpad::db_password', ''),
$admin_password = hiera('etherpadd::admin_password', ''),
- $api_key = hiera('etherpad::api_key', ''),
- $ensure = hiera('etherpad::ensure', 'present')
+ $api_key = hiera('etherpad::api_key', '')
) {
case $db_password {
@@ -10,39 +9,30 @@ class etherpad(
}
mysql_database { 'etherpad':
- ensure => $ensure,
+ ensure => present,
}
mysql_user { "etherpad@%":
- ensure => $ensure,
+ ensure => present,
password_hash => mysql_password($db_password),
require => Mysql_database['etherpad'],
}
- if $ensure == 'present' {
- mysql_grant { "etherpad@%/etherpad":
- privileges => 'all',
- require => Mysql_user["etherpad@%"],
- }
+ mysql_grant { "etherpad@%/etherpad":
+ privileges => 'all',
+ require => Mysql_user["etherpad@%"],
}
group { "etherpad-lite":
- ensure => $ensure,
+ ensure => present,
allowdupe => false,
- require => $ensure ? {
- present => undef,
- default => User['etherpad-lite'], # Make sure the user is removed first
- }
}
user { "etherpad-lite":
- ensure => $ensure,
+ ensure => present,
allowdupe => false,
gid => 'etherpad-lite',
- require => $ensure ? {
- present => Group['etherpad-lite'],
- default => undef,
- }
+ require => Group['etherpad-lite'],
}
file { '/home/etherpad-lite':
@@ -53,11 +43,11 @@ class etherpad(
}
package { [ 'npm', 'abiword' ]:
- ensure => $ensure,
+ ensure => present,
}
vcsrepo { "/var/lib/etherpad-lite":
- ensure => $ensure,
+ ensure => present,
provider => git,
source => 'https://github.com/ether/etherpad-lite.git',
revision => '8fffe4777e366923ee89d380b12eb413c950b721',
@@ -68,7 +58,7 @@ class etherpad(
}
file { '/etc/init.d/etherpad-lite':
- ensure => $ensure,
+ ensure => present,
owner => root,
group => root,
mode => 0755,
@@ -76,24 +66,16 @@ class etherpad(
require => Vcsrepo['/var/lib/etherpad-lite'],
}
- $directory = $ensure ? {
- 'present' => 'directory',
- default => 'absent',
- }
-
file { '/var/log/etherpad-lite':
- ensure => $directory,
+ ensure => directory,
owner => 'etherpad-lite',
group => 'etherpad-lite',
mode => 0755,
- require => $ensure ? {
- present => [ User['etherpad-lite'], Group['etherpad-lite'] ],
- default => undef,
- },
+ require => [ User['etherpad-lite'], Group['etherpad-lite'] ],
}
file { '/etc/logrotate.d/etherpad-lite':
- ensure => $ensure,
+ ensure => present,
owner => root,
group => root,
mode => 0644,
@@ -102,7 +84,7 @@ class etherpad(
}
file { '/var/lib/etherpad-lite/settings.json':
- ensure => $ensure,
+ ensure => present,
owner => 'etherpad-lite',
group => 'etherpad-lite',
mode => 0640,
@@ -113,7 +95,7 @@ class etherpad(
if $api_key != '' {
file { '/var/lib/etherpad-lite/APIKEY.txt':
- ensure => $ensure,
+ ensure => present,
owner => 'etherpad-lite',
group => 'etherpad-lite',
mode => 0640,
@@ -123,20 +105,12 @@ class etherpad(
}
}
- $service = $ensure ? {
- 'present' => 'running',
- default => 'stopped',
- }
-
service { 'etherpad-lite':
enable => true,
- ensure => $service,
+ ensure => running,
hasrestart => true,
hasstatus => true,
- require => $ensure ? {
- present => [ File['/etc/init.d/etherpad-lite', '/var/lib/etherpad-lite/settings.json',
- '/home/etherpad-lite'], Mysql_grant['etherpad@%/etherpad'], Package['npm'] ],
- default => undef,
- },
+ require => [ File['/etc/init.d/etherpad-lite', '/var/lib/etherpad-lite/settings.json',
+ '/home/etherpad-lite'], Mysql_grant['etherpad@%/etherpad'], Package['npm'] ],
}
}