Puppet Class: logstash::config

Defined in:
manifests/config.pp

Overview

This class manages configuration directories for Logstash.

Examples:

Include this class to ensure its resources are available.

include logstash::config

Author:



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

class logstash::config {
  require logstash::package

  File {
    owner => 'root',
    group => 'root',
  }

  # Configuration "fragment" directories for pipeline config and pattern files.
  # We'll keep these seperate since we may want to "purge" them. It's easy to
  # end up with orphan files when managing config fragments with Puppet.
  # Purging the directories resolves the problem.

  if($logstash::ensure == 'present') {
    file { $logstash::config_dir:
      ensure => directory,
      mode   => '0755',
    }

    file { "${logstash::config_dir}/conf.d":
      ensure  => directory,
      purge   => $logstash::purge_config,
      recurse => $logstash::purge_config,
      mode    => '0775',
      notify  => Service['logstash'],
    }

    file { "${logstash::config_dir}/patterns":
      ensure  => directory,
      purge   => $logstash::purge_config,
      recurse => $logstash::purge_config,
      mode    => '0755',
    }
  }
  elsif($logstash::ensure == 'absent') {
    # Completely remove the config directory. ie. 'rm -rf /etc/logstash'
    file { $logstash::config_dir:
      ensure  => 'absent',
      recurse => true,
      force   => true,
    }
  }
}