Defined Type: openiosds::beanstalkd

Defined in:
manifests/beanstalkd.pp

Overview

Configure and install an OpenIO beanstalkd service

Parameters:

  • action (Any) (defaults to: 'create')
  • type (Any) (defaults to: 'beanstalkd')
  • num (Any) (defaults to: '0')
  • ns (Any) (defaults to: undef)
  • ipaddress (Any) (defaults to: $::ipaddress)
  • port (Any) (defaults to: $::openiosds::params::beanstalkd_port)
  • binlogdir (Any) (defaults to: undef)
  • fsync (Any) (defaults to: '1000')
  • binlogsize (Any) (defaults to: '10240000')
  • location (Any) (defaults to: $hostname)
  • no_exec (Any) (defaults to: false)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
# File 'manifests/beanstalkd.pp', line 2

define openiosds::beanstalkd (
  $action           = 'create',
  $type             = 'beanstalkd',
  $num              = '0',

  $ns               = undef,
  $ipaddress        = $::ipaddress,
  $port             = $::openiosds::params::beanstalkd_port,
  $binlogdir        = undef,
  $fsync            = '1000',
  $binlogsize       = '10240000',

  $location         = $hostname,
  $no_exec          = false,
) {

  if ! defined(Class['openiosds']) {
    include openiosds
  }

  # Validation
  validate_string($ns)
  if ! has_interface_with('ipaddress',$ipaddress) { fail("${ipaddress} is invalid.") }
  validate_integer($port)
  if $binlogdir { $_binlogdir = $binlogdir }
  else { $_binlogdir = "${openiosds::sharedstatedir}/${ns}/${type}-${num}" }
  validate_string($location)

  # Namespace
  if $action == 'create' {
    if ! defined(Openiosds::Namespace[$ns]) {
      fail('You must include the namespace class before using OpenIO defined types.')
    }
  }

  # Package
  ensure_packages([$::openiosds::params::beanstalkd_package_name],$::openiosds::params::package_install_options)
  # Service
  openiosds::service {"${ns}-${type}-${num}":
    action => $action,
    type   => $type,
    num    => $num,
    ns     => $ns,
    volume => $_binlogdir,
  } ->
  # Init
  gridinit::program { "${ns}-${type}-${num}":
    action  => $action,
    command => "${openiosds::bindir}/beanstalkd -l ${ipaddress} -p ${port} -u ${::openiosds::user} -b ${_binlogdir} -f ${fsync} -s ${binlogsize}",
    group   => "${ns},${type},${type}-${num}",
    uid     => $openiosds::user,
    gid     => $openiosds::group,
    no_exec => $no_exec,
  }

}