Puppet Class: collectd::config

Inherits:
collectd
Defined in:
manifests/config.pp

Overview

private



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/config.pp', line 2

class collectd::config inherits collectd {
  assert_private()

  $_conf_content = $collectd::purge_config ? {
    true    => template('collectd/collectd.conf.erb'),
    default => $collectd::conf_content,
  }

  file { 'collectd.conf':
    path    => $collectd::config_file,
    owner   => $collectd::config_owner,
    group   => $collectd::config_group,
    mode    => $collectd::config_mode,
    content => $_conf_content,
  }

  if !$collectd::purge_config  and !$_conf_content {
    # former include of conf_d directory
    file_line { 'include_conf_d':
      ensure => absent,
      line   => "Include \"${collectd::plugin_conf_dir}/\"",
      path   => $collectd::config_file,
    }
    # include (conf_d directory)/*.conf
    file_line { 'include_conf_d_dot_conf':
      ensure => present,
      line   => "Include \"${collectd::plugin_conf_dir}/*.conf\"",
      path   => $collectd::config_file,
    }
  }

  file { 'collectd.d':
    ensure  => directory,
    path    => $collectd::plugin_conf_dir,
    mode    => $collectd::plugin_conf_dir_mode,
    owner   => $collectd::config_owner,
    group   => $collectd::config_group,
    purge   => $collectd::purge,
    recurse => $collectd::recurse,
  }

  if $_conf_content {
    concat { 'collectd_typesdb':
      ensure => present,
      mode   => $collectd::config_mode,
      owner  => $collectd::config_group,
      path   => "${collectd::collectd_dir}/typesdb.conf",
    }

    concat::fragment { 'collectd_typesdb_header':
      order   => '10',
      content => template('collectd/typesdb.conf.erb'),
      target  => 'collectd_typesdb',
    }
  }
}