diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/backup.pp | 38 | ||||
-rw-r--r-- | manifests/base.pp | 14 | ||||
-rw-r--r-- | manifests/debian.pp | 7 | ||||
-rw-r--r-- | manifests/init.pp | 11 | ||||
-rw-r--r-- | manifests/params.pp | 18 | ||||
-rw-r--r-- | manifests/redhat.pp | 1 |
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 {} |