summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorkwadronaut <kwadronaut@leap.se>2012-09-25 09:56:13 +0200
committerkwadronaut <kwadronaut@leap.se>2012-09-25 09:56:13 +0200
commitdb599ad72b63b6374ec1d6d25feb02c6cbb56aef (patch)
tree5cf0f399f4ec8d754d31ec7abdaf6e0d99427ae8 /manifests
parentca110db76ad6865f7c736da707fc3828ed4e9d71 (diff)
parent8daa862541facd5207a75760f3656e857faf73fd (diff)
Merge branch 'master' of leap.se:puppet_couchdb
Diffstat (limited to 'manifests')
-rw-r--r--manifests/backup.pp38
-rw-r--r--manifests/base.pp14
-rw-r--r--manifests/debian.pp7
-rw-r--r--manifests/init.pp11
-rw-r--r--manifests/params.pp18
-rw-r--r--manifests/redhat.pp1
6 files changed, 89 insertions, 0 deletions
diff --git a/manifests/backup.pp b/manifests/backup.pp
new file mode 100644
index 0000000..14acff9
--- /dev/null
+++ b/manifests/backup.pp
@@ -0,0 +1,38 @@
+class couchdb::backup {
+
+ include couchdb::params
+
+ # used in ERB templates
+ $bind_address = $couchdb::params::bind_address
+ $port = $couchdb::params::port
+ $backupdir = $couchdb::params::backupdir
+
+ file {$couchdb::params::backupdir:
+ ensure => directory,
+ mode => 755,
+ require => Package["couchdb"],
+ }
+
+ file { "/usr/local/sbin/couchdb-backup.py":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 755,
+ content => template("couchdb/couchdb-backup.py.erb"),
+ require => File[$couchdb::params::backupdir],
+ }
+
+ cron { "couchdb-backup":
+ command => "/usr/local/sbin/couchdb-backup.py 2> /dev/null",
+ hour => 3,
+ minute => 0,
+ require => File["/usr/local/sbin/couchdb-backup.py"],
+ }
+
+ # note: python-couchdb >= 0.8 required, which is found in debian wheezy.
+ package { ["python-couchdb", "python-simplejson"]:
+ ensure => present,
+ before => File["/usr/local/sbin/couchdb-backup.py"],
+ }
+
+}
diff --git a/manifests/base.pp b/manifests/base.pp
new file mode 100644
index 0000000..0671d07
--- /dev/null
+++ b/manifests/base.pp
@@ -0,0 +1,14 @@
+class couchdb::base {
+
+ package {"couchdb":
+ ensure => present,
+ }
+
+ service {"couchdb":
+ ensure => running,
+ hasstatus => true,
+ enable => true,
+ require => Package["couchdb"],
+ }
+
+}
diff --git a/manifests/debian.pp b/manifests/debian.pp
new file mode 100644
index 0000000..053d17a
--- /dev/null
+++ b/manifests/debian.pp
@@ -0,0 +1,7 @@
+class couchdb::debian inherits couchdb::base {
+
+ package {"libjs-jquery":
+ ensure => present,
+ }
+
+}
diff --git a/manifests/init.pp b/manifests/init.pp
index e69de29..cc25f10 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -0,0 +1,11 @@
+class couchdb {
+ case $operatingsystem {
+ Debian: {
+ case $lsbdistcodename {
+ /lenny|squeeze|wheezy/: { include couchdb::debian }
+ default: { fail "couchdb not available for ${operatingsystem}/${lsbdistcodename}"}
+ }
+ }
+ RedHat: { include couchdb::redhat }
+ }
+}
diff --git a/manifests/params.pp b/manifests/params.pp
new file mode 100644
index 0000000..df59ad0
--- /dev/null
+++ b/manifests/params.pp
@@ -0,0 +1,18 @@
+class couchdb::params {
+
+ $bind_address = $couchdb_bind_address ? {
+ "" => "127.0.0.1",
+ default => $couchdb_bind_address,
+ }
+
+ $port = $couchdb_port ? {
+ "" => "5984",
+ default => $couchdb_port,
+ }
+
+ $backupdir = $couchdb_backupdir ? {
+ "" => "/var/backups/couchdb",
+ default => $couchdb_backupdir,
+ }
+
+}
diff --git a/manifests/redhat.pp b/manifests/redhat.pp
new file mode 100644
index 0000000..defa0a9
--- /dev/null
+++ b/manifests/redhat.pp
@@ -0,0 +1 @@
+class couchdb::redhat inherits couchdb::base {}