Defined Type: couchbase::bucket
- Defined in:
- manifests/bucket.pp
Overview
Examples
couchbase::bucket { ‘bucketname’:
port => 11211,
size => 1024,
user => 'couchbase',
password => 'password',
type => 'memcached',
bucket_password => 'somepw'
}
Authors
Justice London <jlondon@syrussystems.com> Portions of code by Lars van de Kerkhof <contact@permanentmarkers.nl>
Copyright
Copyright 2013 Justice London, unless otherwise noted.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'manifests/bucket.pp', line 44
define couchbase::bucket (
$bucketname = $title,
$port = 8091,
$size = 1024,
$user = 'couchbase',
$password = 'password',
$type = 'memcached',
$replica = 1,
$bucket_password = undef,
$flush = 0,
) {
include ::couchbase::params
if $::couchbase::ensure == present {
# all this has to be done before we can create buckets.
Class['couchbase::install'] -> Couchbase::Bucket[$title]
Class['couchbase::config'] -> Couchbase::Bucket[$title]
Class['couchbase::service'] -> Couchbase::Bucket[$title]
#Whether or not to use a bucket password. This probably can use a selector or similar.
$create_defaults = "-u ${user} -p '${password}' --bucket=${bucketname} --bucket-type=${type} --bucket-ramsize=${size} --bucket-port=${port} --bucket-replica=${replica} --enable-flush=${flush}"
if $bucket_password {
$create_command = "${create_defaults} --bucket-password='${bucket_password}'"
}
else {
$create_command = $create_defaults
}
exec {"bucket-create-${bucketname}":
path => ['/opt/couchbase/bin/', '/usr/bin/', '/bin', '/sbin', '/usr/sbin'],
command => "couchbase-cli bucket-create -c 127.0.0.1 ${create_command}",
unless => "couchbase-cli bucket-list -c 127.0.0.1 -u ${user} -p '${password}' | grep -x ${bucketname}",
require => Class['couchbase::config'],
returns => [0, 2],
logoutput => true,
}
}
else {
notify {'Couchbase is configured to be absent. Bucket can not be configured.':}
}
}
|