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 2013 Justice London, unless otherwise noted.

Parameters:

  • version (Any) (defaults to: $couchbase::version)
  • edition (Any) (defaults to: $couchbase::edition)
  • method (Any) (defaults to: $couchbase::install_method)
  • download_url_base (Any) (defaults to: $couchbase::download_url_base)


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
# 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
) {
  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}"

  case $method {
    'curl': {
      exec { 'download_couchbase':
        command => "curl -o /opt/${pkgname} ${pkgsource}",
        creates => "/opt/${pkgname}",
        path    => ['/usr/bin','/usr/sbin','/bin','/sbin'],
      }
      package {'couchbase-server':
        ensure   => installed,
        name     => 'couchbase-server',
        notify   => Exec['couchbase-init'],
        provider => $::couchbase::params::installer,
        require  => [Package[$::couchbase::params::openssl_package], Exec['download_couchbase']],
        source   => "/opt/${pkgname}",
      }
    }
    'package': {
      package {'couchbase-server':
        ensure  => $::couchbase::version,
        name    => 'couchbase-server',
        notify  => Exec['couchbase-init'],
        require => Package[$::couchbase::params::openssl_package],
      }
    }
    default: {
      fail ("${module_name} install_method must be 'package' or 'curl'")
    }
  }

  if !defined(Package[$::couchbase::params::openssl_package]) {
    ensure_packages($::couchbase::params::openssl_package)
  }

}