add configuration and service
This commit is contained in:
@@ -9,4 +9,19 @@ class cd_alloy::main::files (
|
|||||||
|
|
||||||
require cd_alloy::main::dirs
|
require cd_alloy::main::dirs
|
||||||
|
|
||||||
|
# Ensure log_targets is always an array
|
||||||
|
$log_targets_array = Array($cd_alloy::params::ay_log_targets, true)
|
||||||
|
|
||||||
|
file { $ay_main_file:
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
selrange => s0,
|
||||||
|
selrole => object_r,
|
||||||
|
seltype => etc_t,
|
||||||
|
seluser => system_u,
|
||||||
|
content => template('cd_alloy/config.alloy.erb'),
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,10 @@ class cd_alloy::main::service (
|
|||||||
|
|
||||||
require cd_alloy::main::files
|
require cd_alloy::main::files
|
||||||
|
|
||||||
|
service { $ay_service:
|
||||||
|
ensure => running,
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,32 @@
|
|||||||
## cd_alloy::params.pp
|
## cd_alloy::params.pp
|
||||||
# Module name: cd_alloy
|
# Module name: cd_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
||||||
# @param [string] reqpackages which packages to install
|
# @param [string] reqpackages which packages to install
|
||||||
# @param [string] pkg_ensure 'latest' or 'present'
|
# @param [string] pkg_ensure 'latest' or 'present'
|
||||||
|
# @param [string] ay_loki_username the username to logon to loki
|
||||||
|
# @param [string] ay_loki_userpass the password to logon to loki
|
||||||
# @summary Class contains all parameters for the cd_alloy module.
|
# @summary Class contains all parameters for the cd_alloy module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class cd_alloy::params (
|
class cd_alloy::params (
|
||||||
|
|
||||||
$reqpackages = 'alloy',
|
$reqpackages = 'alloy',
|
||||||
$pkg_ensure = 'latest',
|
$pkg_ensure = 'latest',
|
||||||
|
|
||||||
|
# loki
|
||||||
|
$ay_loki_url = 'https://loki.example.net/loki/api/v1/push'
|
||||||
|
$ay_loki_username = '',
|
||||||
|
$ay_loki_userpass = '',
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
# service
|
# service
|
||||||
$ay_service = 'alloy'
|
$ay_service = 'alloy'
|
||||||
|
|
||||||
# dirs
|
# dirs
|
||||||
$ay_main_dir = '/etc/alloy'
|
$ay_main_dir = '/etc/alloy'
|
||||||
|
|
||||||
|
# files
|
||||||
|
$ay_main_file = "$(ay_main_dir)/config.alloy"
|
||||||
|
|
||||||
|
|
||||||
# includes must be last
|
# includes must be last
|
||||||
|
|||||||
23
templates/config.alloy.erb
Normal file
23
templates/config.alloy.erb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
logging {
|
||||||
|
level = "info"
|
||||||
|
format = "logfmt"
|
||||||
|
}
|
||||||
|
|
||||||
|
loki.source.file "system_logs" {
|
||||||
|
targets = [
|
||||||
|
<% @log_targets_array.each do |target| -%>
|
||||||
|
{__path__ = "<%= target %>"},
|
||||||
|
<% end -%>
|
||||||
|
]
|
||||||
|
forward_to = [loki.write.loki.receiver]
|
||||||
|
}
|
||||||
|
|
||||||
|
loki.write "loki" {
|
||||||
|
endpoint {
|
||||||
|
url = "https://loki.confdroid.com/loki/api/v1/push"
|
||||||
|
basic_auth {
|
||||||
|
username = "<%= @ay_loki_username %>"
|
||||||
|
password = "<%= @ay_loki_userpass %>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user