Puppet Class: kafka::broker::config

Defined in:
manifests/broker/config.pp

Summary

This class handles the Kafka (broker) config.

Overview

Parameters:

  • manage_service (Boolean) (defaults to: $kafka::broker::manage_service)
  • service_name (String[1]) (defaults to: $kafka::broker::service_name)
  • service_restart (Boolean) (defaults to: $kafka::broker::service_restart)
  • config (Hash[String[1], Any]) (defaults to: $kafka::broker::config)
  • config_dir (Stdlib::Absolutepath) (defaults to: $kafka::broker::config_dir)
  • user_name (String[1]) (defaults to: $kafka::broker::user_name)
  • group_name (String[1]) (defaults to: $kafka::broker::group_name)
  • config_mode (Stdlib::Filemode) (defaults to: $kafka::broker::config_mode)
  • manage_log4j (Boolean) (defaults to: $kafka::broker::manage_log4j)
  • log_file_size (Pattern[/[1-9][0-9]*[KMG]B/]) (defaults to: $kafka::broker::log_file_size)
  • log_file_count (Integer[1, 50]) (defaults to: $kafka::broker::log_file_count)


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

class kafka::broker::config (
  Boolean $manage_service                       = $kafka::broker::manage_service,
  String[1] $service_name                       = $kafka::broker::service_name,
  Boolean $service_restart                      = $kafka::broker::service_restart,
  Hash[String[1], Any] $config                  = $kafka::broker::config,
  Stdlib::Absolutepath $config_dir              = $kafka::broker::config_dir,
  String[1] $user_name                          = $kafka::broker::user_name,
  String[1] $group_name                         = $kafka::broker::group_name,
  Stdlib::Filemode $config_mode                 = $kafka::broker::config_mode,
  Boolean $manage_log4j                         = $kafka::broker::manage_log4j,
  Pattern[/[1-9][0-9]*[KMG]B/] $log_file_size   = $kafka::broker::log_file_size,
  Integer[1, 50] $log_file_count                = $kafka::broker::log_file_count,
) {
  assert_private()

  if ($manage_service and $service_restart) {
    $config_notify = Service[$service_name]
  } else {
    $config_notify = undef
  }

  $doctag = 'brokerconfigs'
  file { "${config_dir}/server.properties":
    ensure  => file,
    owner   => $user_name,
    group   => $group_name,
    mode    => $config_mode,
    content => template('kafka/properties.erb'),
    notify  => $config_notify,
    require => File[$config_dir],
  }

  if $manage_log4j {
    file { "${config_dir}/log4j.properties":
      ensure  => file,
      owner   => $user_name,
      group   => $group_name,
      mode    => $config_mode,
      content => epp('kafka/log4j.properties.epp', { 'log_file_size' => $log_file_size, 'log_file_count' => $log_file_count }),
      notify  => $config_notify,
      require => File[$config_dir],
    }
  }
}