Puppet Class: confluent::ksql
- Inherits:
- confluent::params
- Defined in:
- manifests/ksql.pp
Overview
Class is used to install KSQL Server.
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'manifests/ksql.pp', line 38
class confluent::ksql (
$bootstrap_servers,
$config = {},
$environment_settings = {},
$config_path = $::confluent::params::ksql_config_path,
$logging_config_path = $::confluent::params::ksql_logging_config_path,
$environment_file = $::confluent::params::ksql_environment_path,
$log_path = $::confluent::params::ksql_log_path,
$user = $::confluent::params::ksql_user,
$service_name = $::confluent::params::ksql_service,
$manage_service = $::confluent::params::ksql_manage_service,
$service_ensure = $::confluent::params::ksql_service_ensure,
$service_enable = $::confluent::params::ksql_service_enable,
$file_limit = $::confluent::params::ksql_file_limit,
$manage_repository = $::confluent::params::manage_repository,
$stop_timeout_secs = $::confluent::params::ksql_stop_timeout_secs,
$heap_size = $::confluent::params::ksql_heap_size,
$restart_on_logging_change = true,
$restart_on_change = true
) inherits confluent::params {
include ::confluent
if($manage_repository) {
include ::confluent::repository
}
$default_config = {
'bootstrap.servers' => join(any2array($bootstrap_servers), ','),
'listeners' => 'http://0.0.0.0:8088',
'debug' => false,
}
$actual_config = merge($default_config, $config)
confluent::properties { $service_name:
ensure => present,
path => $config_path,
config => $actual_config,
}
$default_environment_settings = {
'KSQL_HEAP_OPTS' => "-Xmx${heap_size}",
'GC_LOG_ENABLED' => true,
'LOG_DIR' => $log_path,
'KAFKA_LOG4J_OPTS' => "-Dlog4j.configuration=file:${logging_config_path}",
}
$actual_environment_settings = merge($default_environment_settings, $environment_settings)
confluent::environment { $service_name:
ensure => present,
path => $environment_file,
config => $actual_environment_settings,
}
confluent::logging { $service_name:
path => $logging_config_path,
}
user { $user:
ensure => present,
}
-> file { [$log_path]:
ensure => directory,
owner => $user,
group => $user,
recurse => true,
tag => '__confluent__',
}
package { 'confluent-ksql':
ensure => installed,
tag => '__confluent__',
}
confluent::systemd::unit { $service_name:
config => {
'Unit' => {
'Description' => 'KSQL Server by Confluent',
},
'Service' => {
'User' => $user,
'EnvironmentFile' => $environment_file,
'ExecStart' => "/usr/bin/ksql-server-start ${config_path}",
'ExecStop' => '/usr/bin/ksql-server-stop',
'LimitNOFILE' => $file_limit,
},
},
}
if($manage_service) {
service { $service_name:
ensure => $service_ensure,
enable => $service_enable,
tag => '__confluent__',
}
if($restart_on_change) {
Confluent::Systemd::Unit[$service_name] ~> Service[$service_name]
Confluent::Environment[$service_name] ~> Service[$service_name]
Confluent::Properties[$service_name] ~> Service[$service_name]
if($restart_on_logging_change) {
Confluent::Logging[$service_name] ~> Service[$service_name]
}
}
}
}
|