Puppet Class: psick::logs::rsyslog

Defined in:
manifests/logs/rsyslog.pp

Overview

This class manages the installation and configuration of rsyslog via tp

Parameters:

  • ensure (Enum['present','absent']) (defaults to: 'present')

    If to install or remove the rsyslog package

  • config_dir_source (Variant[String[1],Undef]) (defaults to: undef)

    The source to use (as used in source =>) to populate the whole rsyslog configuration directory

  • config_file_template (String) (defaults to: '')

    The erb template (as used in template()) to manage the content of the rsyslog main configuration file

  • server_ip (Array) (defaults to: [])

    An array of IPs o syslog servers where to send logs

  • options

    An open hash of options to use in the provided template. Note: This variable is not a class paramenter but it’s looked up with lookup(‘psick::logs::rsyslog::options’, {} )



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
58
59
60
61
62
63
64
65
# File 'manifests/logs/rsyslog.pp', line 13

class psick::logs::rsyslog (
  Enum['present','absent'] $ensure               = 'present',

  Variant[String[1],Undef] $config_dir_source    = undef,
  String                   $config_file_template = '', # lint:ignore:params_empty_string_assignment
  Array                    $server_ip            = [],
) {
  $options_default = {
  }
  $options_user=lookup('psick::logs::rsyslog::options', Hash, 'deep', {})
  $options=merge($options_default,$options_user)

  ::tp::install { 'rsyslog':
    ensure => $ensure,
  }

  if $config_file_template != '' {
    ::tp::conf { 'rsyslog':
      ensure       => $ensure,
      template     => $config_file_template,
      options_hash => $options,
    }
  }

  ::tp::dir { 'rsyslog':
    ensure => $ensure,
    source => $config_dir_source,
  }

  if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' {
    ::tp::conf { 'rsyslog::20-default.conf':
      ensure       => $ensure,
      template     => 'psick/logs/rsyslog/20-default.erb',
      options_hash => $options,
      base_dir     => 'conf',
    }
    ::tp::conf { 'rsyslog::50-default.conf':
      ensure       => $ensure,
      template     => 'psick/logs/rsyslog/50-default.erb',
      options_hash => $options,
      base_dir     => 'conf',
    }
  }

  if $server_ip != [] {
    ::tp::conf { 'rsyslog::60-syslogserver.conf':
      ensure       => $ensure,
      template     => 'psick/logs/rsyslog/60-syslogserver.erb',
      base_dir     => 'conf',
      options_hash => { server_ip => $server_ip },
    }
  }
}