Puppet Class: mcelog

Inherits:
mcelog::params
Defined in:
manifests/init.pp

Summary

Manage mcelog

Overview

Examples:

include ::mcelog

Parameters:

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

    Defines state of mcelog. Setting to absent will completely remove mcelog

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

    Settings hash to be passed to mcelog.conf INI file. Keys are the section in mcelog.log and empty key is global settings The values are key/value pairs of setting and value under a given section.

  • service_ensure (Optional[Enum['running','stopped']]) (defaults to: undef)

    Service ensure value. Default is based on ensure parameter value.



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
66
67
68
69
# File 'manifests/init.pp', line 15

class mcelog (
  Enum['present','absent'] $ensure = 'present',
  Hash $settings = {},
  Optional[Enum['running','stopped']] $service_ensure = undef,
) inherits mcelog::params {
  case $ensure {
    'present': {
      $package_ensure = 'present'
      $file_ensure    = 'file'
      $_service_ensure = pick($service_ensure, 'running')
      $service_enable = true
    }
    'absent': {
      $package_ensure = 'absent'
      $file_ensure    = 'absent'
      $_service_ensure = pick($service_ensure, 'stopped')
      $service_enable = false
    }
    default: {
      # Do nothing
    }
  }

  package { 'mcelog':
    ensure => $package_ensure,
    name   => $::mcelog::params::package_name,
    before => File['mcelog.conf'],
  }

  file { 'mcelog.conf':
    ensure => $file_ensure,
    path   => $::mcelog::params::config_file_path,
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
    notify => Service['mcelog'],
  }

  $mcelog_ini_defaults = {
    'path'    => $::mcelog::params::config_file_path,
    'require' => Package['mcelog'],
    'notify'  => Service['mcelog'],
  }
  if $ensure == 'present' {
    create_ini_settings($settings, $mcelog_ini_defaults)
  }

  service { 'mcelog':
    ensure     => $_service_ensure,
    enable     => $service_enable,
    name       => $::mcelog::params::service_name,
    hasstatus  => true,
    hasrestart => true,
  }
}