Puppet Class: stackdriver

Overview

vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 foldmethod=marker

Class: stackdriver

This module manages the Stackdriver Agent (www.stackdriver.com)

Parameters


apikey
  • Default - NONE (REQUIRED)

  • Stackdriver API key

svc
  • Default - Depends on $::osfamily

  • Stackdriver Agent service name

Examples:

Basic agent configuration

class { 'stackdriver':
  apikey => "OMGBECKYLOOKATHERBUTTITSJUSTSOROUND"
}

Parameters:

  • apikey (Any) (defaults to: undef)
  • ensure (Any) (defaults to: 'present')
  • service_ensure (Any) (defaults to: 'running')
  • service_enable (Any) (defaults to: true)
  • svc (Any) (defaults to: $::osfamily ? { 'RedHat' => [ 'stackdriver-agent', 'stackdriver-extractor' ], 'Debian' => [ 'stackdriver-agent', 'stackdriver-extractor' ], default => undef)


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
# File 'manifests/init.pp', line 26

class stackdriver (

  $apikey = undef,
  $ensure = 'present',
  $service_ensure = 'running',
  $service_enable = true,

  $svc = $::osfamily ? {
    'RedHat'  => [ 'stackdriver-agent', 'stackdriver-extractor' ],
    'Debian'  => [ 'stackdriver-agent', 'stackdriver-extractor' ],
    default   => undef,
  },

) {

  validate_string ( $apikey )
  validate_array  ( $svc    )

  # Runtime class definitions
  $iclass = "${name}::install::${::osfamily}"
  $cclass = "${name}::config::${::osfamily}"
  $sclass = "${name}::service"


  # OS Family specific installation
  class { "::${iclass}":
    ensure => $ensure,
    notify => Class[$sclass],
  }
  contain $iclass


  # OS Family specific configuration
  class { "::${cclass}": require => Class[$iclass]; }
  contain $cclass


  # Service
  class { "::${sclass}":
    service_ensure => $service_ensure,
    service_enable => $service_enable,
    require        => Class[$cclass],
  }
  include $sclass

  # Array of Plugins to load (optional)
  $plugins = hiera_array("${name}::plugins", [])

  if ! empty($plugins) {
    stackdriver::plugin { $plugins: }
  }

}