summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-09 14:47:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-09 14:47:46 -0300
commit6ff01084a8feb2644b8f76660fe0ac384aa3e54c (patch)
tree0eeaa5ca9ab76c63c9d53792ad049cc7953e8988
parentf8cc437ebe2633f0cdf1a22657461275b2500dce (diff)
downloadpuppet-etherpad-6ff01084a8feb2644b8f76660fe0ac384aa3e54c.tar.gz
puppet-etherpad-6ff01084a8feb2644b8f76660fe0ac384aa3e54c.tar.bz2
Upgrading etherpad and adding ensurable parameter
-rw-r--r--manifests/init.pp42
1 files changed, 25 insertions, 17 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 1cadc5e..82ce3f8 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,7 +1,8 @@
class etherpad(
- $db_password = hiera('etherpad::db_password', ''),
+ $db_password = hiera('etherpad::db_password', ''),
$admin_password = hiera('etherpadd::admin_password', ''),
- $api_key = hiera('etherpad::api_key', '')
+ $api_key = hiera('etherpad::api_key', ''),
+ $ensure = hiera('etherpad::ensure', 'present')
) {
case $db_password {
@@ -9,27 +10,29 @@ class etherpad(
}
mysql_database { 'etherpad':
- ensure => present,
+ ensure => $ensure,
}
mysql_user { "etherpad@%":
- ensure => present,
+ ensure => $ensure,
password_hash => mysql_password($db_password),
require => Mysql_database['etherpad'],
}
- mysql_grant { "etherpad@%/etherpad":
- privileges => 'all',
- require => Mysql_user["etherpad@%"],
+ if $ensure == 'present' {
+ mysql_grant { "etherpad@%/etherpad":
+ privileges => 'all',
+ require => Mysql_user["etherpad@%"],
+ }
}
group { "etherpad-lite":
- ensure => present,
+ ensure => $ensure,
allowdupe => false,
}
user { "etherpad-lite":
- ensure => present,
+ ensure => $ensure,
allowdupe => false,
gid => 'etherpad-lite',
require => Group['etherpad-lite'],
@@ -43,14 +46,14 @@ class etherpad(
}
package { [ 'npm', 'abiword' ]:
- ensure => present,
+ ensure => $ensure,
}
vcsrepo { "/var/lib/etherpad-lite":
- ensure => present,
+ ensure => $ensure,
provider => git,
source => 'https://github.com/ether/etherpad-lite.git',
- revision => '5f30ea447e35378e84a570d61676feef021a7eb6',
+ revision => '8fffe4777e366923ee89d380b12eb413c950b721',
owner => 'etherpad-lite',
group => 'etherpad-lite',
require => [ User['etherpad-lite'], Group['etherpad-lite'] ],
@@ -58,7 +61,7 @@ class etherpad(
}
file { '/etc/init.d/etherpad-lite':
- ensure => present,
+ ensure => $ensure,
owner => root,
group => root,
mode => 0755,
@@ -75,7 +78,7 @@ class etherpad(
}
file { '/etc/logrotate.d/etherpad-lite':
- ensure => present,
+ ensure => $ensure,
owner => root,
group => root,
mode => 0644,
@@ -84,7 +87,7 @@ class etherpad(
}
file { '/var/lib/etherpad-lite/settings.json':
- ensure => present,
+ ensure => $ensure,
owner => 'etherpad-lite',
group => 'etherpad-lite',
mode => 0640,
@@ -95,7 +98,7 @@ class etherpad(
if $api_key != '' {
file { '/var/lib/etherpad-lite/APIKEY.txt':
- ensure => present,
+ ensure => $ensure,
owner => 'etherpad-lite',
group => 'etherpad-lite',
mode => 0640,
@@ -105,9 +108,14 @@ class etherpad(
}
}
+ $service = $ensure ? {
+ 'present' => 'running',
+ default => 'stopped',
+ }
+
service { 'etherpad-lite':
enable => true,
- ensure => running,
+ ensure => $service,
hasrestart => true,
hasstatus => true,
require => [ File['/etc/init.d/etherpad-lite', '/var/lib/etherpad-lite/settings.json',