Puppet Class: couchbase::install
- Defined in:
- manifests/install.pp
Overview
Class: couchbase::install
Installs the couchbase-server package on server
Parameters
- version
-
The version of the couchbase package to install
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.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'manifests/install.pp', line 18
class couchbase::install (
$version = $couchbase::version,
$edition = $couchbase::edition,
$method = $couchbase::install_method,
$download_url_base = $couchbase::download_url_base,
$data_dir = $couchbase::data_dir
) {
include ::couchbase::params
$pkgname_enterprise = "couchbase-server-enterprise${::couchbase::params::pkgverspacer}${version}-${::couchbase::params::osname}${::couchbase::params::pkgarch}.${::couchbase::params::pkgtype}"
$pkgname_community = "couchbase-server-community${::couchbase::params::pkgverspacer}${version}-${::couchbase::params::osname}${::couchbase::params::pkgarch}.${::couchbase::params::pkgtype}"
$pkgname = $edition ? {
'enterprise' => $pkgname_enterprise,
'community' => $pkgname_community,
default => $pkgname_community,
}
$pkgsource = "${download_url_base}/${version}/${pkgname}"
$pkg_package = $edition ? {
'enterprise' => "${version} ${method} ${::couchbase::params::installer}" ? {
'4.6.2 curl rpm' => 'couchbase-server',
default => 'couchbase-server-enterprise',
},
default => 'couchbase-server-community',
}
case $method {
'curl': {
exec { 'download_couchbase':
command => "curl -o /opt/${pkgname} ${pkgsource}",
creates => "/opt/${pkgname}",
path => ['/usr/bin','/usr/sbin','/bin','/sbin'],
unless => "test -e /opt/${pkgname}",
}
package {$pkg_package:
ensure => installed,
name => $pkg_package,
provider => $::couchbase::params::installer,
require => [Package[$::couchbase::params::openssl_package], Exec['download_couchbase']],
source => "/opt/${pkgname}",
}
}
'package': {
package {$pkg_package:
ensure => $::couchbase::version,
name => $pkg_package,
require => Package[$::couchbase::params::openssl_package],
}
}
default: {
fail ("${module_name} install_method must be 'package' or 'curl'")
}
}
# This is so dumb.
# https://forums.couchbase.com/t/centos-7-couchbase-server-cannot-start-the-service/6261
if $::osfamily == 'RedHat' {
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
exec { 'no_symbolic_link':
path => '/usr/bin:/usr/local/bin',
command => 'unlink /etc/init.d/couchbase-server && cp /opt/couchbase/etc/couchbase_init.d /etc/init.d/couchbase-server && systemctl daemon-reload',
onlyif => 'test -L /etc/init.d/couchbase-server',
require => Package[$pkg_package],
}
}
}
if ! defined(Package["${::couchbase::params::openssl_package}"]) {
ensure_packages($::couchbase::params::openssl_package)
}
# Ensure data directory is configured properly
file {$data_dir:
ensure => directory,
recurse => true,
owner => 'couchbase',
require => Package[$pkg_package],
}
}
|