Puppet Class: psick::grafana

Defined in:
manifests/grafana.pp

Summary

This psick profile manages grafana with Tiny Puppet (tp)

Overview

psick::grafana

Examples:

Include it to install grafana

include psick::grafana

Include in PSICK via hiera (yaml)

psick::profiles::linux_classes:
  grafana: psick::grafana

Set no-noop mode and enforce changes even if noop is set for the agent

psick::grafana::no_noop: true

Parameters:

  • manage (Boolean) (defaults to: $::psick::manage)

    If to actually manage any resource in this profile or not

  • auto_prereq (Boolean) (defaults to: $::psick::auto_prereq)

    If to automatically install eventual dependencies. Set to false if you have problems with duplicated resources, being sure that you provide the needed prerequistes.

  • options_hash (Hash) (defaults to: {})

    An custom hash of keypair which may be used in templates to manage any grafana setting.

  • module (String) (defaults to: 'psick')

    What module to use to manage grafana. By default psick is used. The specified module name, if different, must be added to Puppetfile.

  • no_noop (Boolean) (defaults to: false)

    Set noop metaparameter to false to all the resources of this class. This overrides any noop setting which might be in place.

  • ensure (Psick::Ensure) (defaults to: 'present')
  • config_template (String) (defaults to: 'psick/generic/inifile_with_stanzas.erb')
  • dashboards_hash (Hash) (defaults to: {})
  • datasources_hash (Hash) (defaults to: {})
  • plugins_hash (Hash) (defaults to: {})


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

class psick::grafana (
  Psick::Ensure   $ensure                   = 'present',
  Boolean         $manage                   = $::psick::manage,
  Boolean         $auto_prereq              = $::psick::auto_prereq,
  Hash            $options_hash             = {},
  String          $module                   = 'psick',
  Boolean         $no_noop                  = false,

  String          $config_template          = 'psick/generic/inifile_with_stanzas.erb',

  Hash            $dashboards_hash          = {},
  Hash            $datasources_hash         = {},
  Hash            $plugins_hash             = {},
) {

  # We declare resources only if $manage = true
  if $manage {

    # If no_noop is set it's enforced, unless psick::noop_mode is 
    if !$::psick::noop_mode and $no_noop {
      info('Forced no-noop mode in psick::grafana')
      noop(false)
    }

    # Managed resources according to $module selected
    case $module {
      'psick': {
        contain ::psick::grafana::tp
      }
      'tp_profile': {
        contain ::tp_profile::grafana
      }
      default: {
        contain $module
      }
    }

    # Default config_template uses $parameters var. We manage it if data is
    # provided
    $parameters = $options_hash
    if $parameters != {} {
      tp::conf { 'grafana':
        content => template($config_template),
      }
    }
    $datasources_hash.each | $k,$v | {
      psick::grafana::datasource { $k:
        * => $v,
      }
    }
    $dashboards_hash.each | $k,$v | {
      psick::grafana::dashboard { $k:
        * => $v,
      }
    }
    $plugins_hash.each | $k,$v | {
      psick::grafana::plugin { $k:
        * => $v,
      }
    }
  }
}