rsyslog: make all module params configurable
+ support false for *_package_name variables. This is useful if relp support is not necessary as it happens that no packages exist for RedHat < 6. All these changes should be fully backward compatible.
This commit is contained in:
Родитель
08c4996586
Коммит
a726b40454
|
@ -38,10 +38,10 @@ class rsyslog::client (
|
|||
default => template($custom_config),
|
||||
}
|
||||
|
||||
file { $rsyslog::params::client_conf:
|
||||
file { $rsyslog::client_conf:
|
||||
ensure => present,
|
||||
owner => root,
|
||||
group => $rsyslog::params::run_group,
|
||||
group => $rsyslog::run_group,
|
||||
content => $content_real,
|
||||
require => Class['rsyslog::config'],
|
||||
notify => Class['rsyslog::service'],
|
||||
|
|
|
@ -10,40 +10,39 @@
|
|||
#
|
||||
# class { 'rsyslog::config': }
|
||||
#
|
||||
class rsyslog::config inherits rsyslog::params {
|
||||
|
||||
file { $rsyslog::params::rsyslog_d:
|
||||
class rsyslog::config {
|
||||
file { $rsyslog::rsyslog_d:
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => $rsyslog::params::run_group,
|
||||
purge => $rsyslog::params::purge_rsyslog_d,
|
||||
group => $rsyslog::run_group,
|
||||
purge => $rsyslog::purge_rsyslog_d,
|
||||
recurse => true,
|
||||
force => true,
|
||||
require => Class['rsyslog::install'],
|
||||
}
|
||||
|
||||
file { $rsyslog::params::rsyslog_conf:
|
||||
file { $rsyslog::rsyslog_conf:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => $rsyslog::params::run_group,
|
||||
group => $rsyslog::run_group,
|
||||
content => template("${module_name}/rsyslog.conf.erb"),
|
||||
require => Class['rsyslog::install'],
|
||||
notify => Class['rsyslog::service'],
|
||||
}
|
||||
|
||||
file { $rsyslog::params::rsyslog_default:
|
||||
file { $rsyslog::rsyslog_default:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => $rsyslog::params::run_group,
|
||||
group => $rsyslog::run_group,
|
||||
source => 'puppet:///modules/rsyslog/rsyslog_default',
|
||||
require => Class['rsyslog::install'],
|
||||
notify => Class['rsyslog::service'],
|
||||
}
|
||||
|
||||
file { $rsyslog::params::spool_dir:
|
||||
file { $rsyslog::spool_dir:
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => $rsyslog::params::run_group,
|
||||
group => $rsyslog::run_group,
|
||||
require => Class['rsyslog::install'],
|
||||
notify => Class['rsyslog::service'],
|
||||
}
|
||||
|
|
|
@ -31,23 +31,23 @@ class rsyslog::database (
|
|||
) inherits rsyslog {
|
||||
|
||||
$db_module = "om${backend}"
|
||||
$db_conf = "${rsyslog::params::rsyslog_d}${backend}.conf"
|
||||
$db_conf = "${rsyslog::rsyslog_d}${backend}.conf"
|
||||
|
||||
case $backend {
|
||||
mysql: { $db_package = $rsyslog::params::mysql_package_name }
|
||||
pgsql: { $db_package = $rsyslog::params::pgsql_package_name }
|
||||
mysql: { $db_package = $rsyslog::mysql_package_name }
|
||||
pgsql: { $db_package = $rsyslog::pgsql_package_name }
|
||||
default: { fail("Unsupported backend: ${backend}. Only MySQL (mysql) and PostgreSQL (pgsql) are supported.") }
|
||||
}
|
||||
|
||||
package { $db_package:
|
||||
ensure => $rsyslog::params::package_status,
|
||||
ensure => $rsyslog::package_status,
|
||||
before => File[$db_conf],
|
||||
}
|
||||
|
||||
file { $db_conf:
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => $rsyslog::params::run_group,
|
||||
group => $rsyslog::run_group,
|
||||
mode => '0600',
|
||||
content => template("${module_name}/database.conf.erb"),
|
||||
require => Class['rsyslog::config'],
|
||||
|
|
|
@ -30,12 +30,10 @@ define rsyslog::imfile(
|
|||
$run_file_monitor = true
|
||||
) {
|
||||
|
||||
include rsyslog::params
|
||||
|
||||
file { "${rsyslog::params::rsyslog_d}${name}.conf":
|
||||
file { "${rsyslog::rsyslog_d}${name}.conf":
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => $rsyslog::params::run_group,
|
||||
group => $rsyslog::run_group,
|
||||
content => template('rsyslog/imfile.erb'),
|
||||
require => Class['rsyslog::install'],
|
||||
notify => Class['rsyslog::service'],
|
||||
|
|
|
@ -10,7 +10,27 @@
|
|||
#
|
||||
# class { 'rsyslog': }
|
||||
#
|
||||
class rsyslog {
|
||||
class rsyslog (
|
||||
$rsyslog_package_name = $rsyslog::params::rsyslog_package_name,
|
||||
$relp_package_name = $rsyslog::params::relp_package_name,
|
||||
$mysql_package_name = $rsyslog::params::mysql_package_name,
|
||||
$pgsql_package_name = $rsyslog::params::pgsql_package_name,
|
||||
$package_status = $rsyslog::params::package_status,
|
||||
$rsyslog_d = $rsyslog::params::rsyslog_d,
|
||||
$rsyslog_conf = $rsyslog::params::rsyslog_conf,
|
||||
$rsyslog_default = $rsyslog::params::rsyslog_default,
|
||||
$run_user = $rsyslog::params::run_user,
|
||||
$run_group = $rsyslog::params::run_group,
|
||||
$log_user = $rsyslog::params::log_user,
|
||||
$log_group = $rsyslog::params::log_group,
|
||||
$log_style = $rsyslog::params::log_style,
|
||||
$perm_file = $rsyslog::params::perm_file,
|
||||
$perm_dir = $rsyslog::params::perm_dir,
|
||||
$spool_dir = $rsyslog::params::spool_dir,
|
||||
$service_name = $rsyslog::params::service_name,
|
||||
$client_conf = $rsyslog::params::client_conf,
|
||||
$server_conf = $rsyslog::params::server_conf,
|
||||
) inherits rsyslog::params {
|
||||
class { 'rsyslog::install': }
|
||||
class { 'rsyslog::config': }
|
||||
class { 'rsyslog::service': }
|
||||
|
|
|
@ -10,14 +10,17 @@
|
|||
#
|
||||
# class { 'rsyslog::install': }
|
||||
#
|
||||
class rsyslog::install inherits rsyslog::params {
|
||||
|
||||
package { $rsyslog::params::rsyslog_package_name:
|
||||
ensure => $rsyslog::params::package_status,
|
||||
class rsyslog::install {
|
||||
if $rsyslog::rsyslog_package_name != false {
|
||||
package { $rsyslog::rsyslog_package_name:
|
||||
ensure => $rsyslog::package_status,
|
||||
}
|
||||
}
|
||||
|
||||
package { $rsyslog::params::relp_package_name:
|
||||
ensure => $rsyslog::params::package_status
|
||||
if $rsyslog::relp_package_name != false {
|
||||
package { $rsyslog::relp_package_name:
|
||||
ensure => $rsyslog::package_status
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ class rsyslog::server (
|
|||
default => template($custom_config),
|
||||
}
|
||||
|
||||
file { $rsyslog::params::server_conf:
|
||||
file { $rsyslog::server_conf:
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => $rsyslog::params::run_group,
|
||||
group => $rsyslog::run_group,
|
||||
content => $real_content,
|
||||
require => Class['rsyslog::config'],
|
||||
notify => Class['rsyslog::service'],
|
||||
|
|
|
@ -10,12 +10,10 @@
|
|||
#
|
||||
# class { 'rsyslog::service': }
|
||||
#
|
||||
class rsyslog::service inherits rsyslog::params {
|
||||
|
||||
service { $rsyslog::params::service_name:
|
||||
class rsyslog::service {
|
||||
service { $rsyslog::service_name:
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Class['rsyslog::config'],
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ define rsyslog::snippet(
|
|||
|
||||
include rsyslog
|
||||
|
||||
file { "${rsyslog::params::rsyslog_d}${name}.conf":
|
||||
file { "${rsyslog::rsyslog_d}${name}.conf":
|
||||
ensure => $ensure,
|
||||
owner => $rsyslog::params::run_user,
|
||||
group => $rsyslog::params::run_group,
|
||||
owner => $rsyslog::run_user,
|
||||
group => $rsyslog::run_group,
|
||||
content => "${content}\n",
|
||||
require => Class['rsyslog::config'],
|
||||
notify => Class['rsyslog::service'],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# file is managed by puppet
|
||||
|
||||
# An "In-Memory Queue" is created for remote logging.
|
||||
$WorkDirectory <%= scope.lookupvar('rsyslog::params::spool_dir') -%> # where to place spool files
|
||||
$WorkDirectory <%= scope.lookupvar('rsyslog::spool_dir') -%> # where to place spool files
|
||||
$ActionQueueFileName queue # unique name prefix for spool files
|
||||
$ActionQueueMaxDiskSpace <%= scope.lookupvar('rsyslog::client::spool_size') -%> # spool space limit (use as much as possible)
|
||||
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
|
||||
|
@ -21,17 +21,17 @@ $ActionResumeRetryCount -1 # infinety retries if host is down
|
|||
# We log locally, restore to default format
|
||||
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
|
||||
|
||||
<% if scope.lookupvar('rsyslog::params::log_style') == 'debian' -%>
|
||||
<% if scope.lookupvar('rsyslog::log_style') == 'debian' -%>
|
||||
# Log auth messages locally
|
||||
auth,authpriv.* /var/log/auth.log
|
||||
<% elsif scope.lookupvar('rsyslog::params::log_style') == 'redhat' -%>
|
||||
<% elsif scope.lookupvar('rsyslog::log_style') == 'redhat' -%>
|
||||
# Log auth messages locally
|
||||
auth,authpriv.* /var/log/secure
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
<% if scope.lookupvar('rsyslog::client::log_local') -%>
|
||||
<% if scope.lookupvar('rsyslog::params::log_style') == 'debian' -%>
|
||||
<% if scope.lookupvar('rsyslog::log_style') == 'debian' -%>
|
||||
# First some standard log files. Log by facility.
|
||||
#
|
||||
*.*;auth,authpriv.none -/var/log/syslog
|
||||
|
@ -89,7 +89,7 @@ daemon.*;mail.*;\
|
|||
news.err;\
|
||||
*.=debug;*.=info;\
|
||||
*.=notice;*.=warn |/dev/xconsole
|
||||
<% elsif scope.lookupvar('rsyslog::params::log_style') == 'redhat' -%>
|
||||
<% elsif scope.lookupvar('rsyslog::log_style') == 'redhat' -%>
|
||||
# Log all kernel messages to the console.
|
||||
# Logging much else clutters up the screen.
|
||||
#kern.* /dev/console
|
||||
|
|
|
@ -15,17 +15,17 @@ $ModLoad imklog # provides kernel logging support (previously done by rklogd)
|
|||
#
|
||||
# Set the default permissions for all log files.
|
||||
#
|
||||
$FileOwner <%= scope.lookupvar('rsyslog::params::log_user') %>
|
||||
$FileGroup <%= scope.lookupvar('rsyslog::params::log_group') %>
|
||||
$FileCreateMode <%= scope.lookupvar('rsyslog::params::perm_file') %>
|
||||
$DirCreateMode <%= scope.lookupvar('rsyslog::params::perm_dir') %>
|
||||
$PrivDropToUser <%= scope.lookupvar('rsyslog::params::run_user') %>
|
||||
$PrivDropToGroup <%= scope.lookupvar('rsyslog::params::run_group') %>
|
||||
$FileOwner <%= scope.lookupvar('rsyslog::log_user') %>
|
||||
$FileGroup <%= scope.lookupvar('rsyslog::log_group') %>
|
||||
$FileCreateMode <%= scope.lookupvar('rsyslog::perm_file') %>
|
||||
$DirCreateMode <%= scope.lookupvar('rsyslog::perm_dir') %>
|
||||
$PrivDropToUser <%= scope.lookupvar('rsyslog::run_user') %>
|
||||
$PrivDropToGroup <%= scope.lookupvar('rsyslog::run_group') %>
|
||||
|
||||
#
|
||||
# Include all config files in <%= scope.lookupvar('rsyslog::params::rsyslog_d') %>
|
||||
# Include all config files in <%= scope.lookupvar('rsyslog::rsyslog_d') %>
|
||||
#
|
||||
$IncludeConfig <%= scope.lookupvar('rsyslog::params::rsyslog_d') -%>*.conf
|
||||
$IncludeConfig <%= scope.lookupvar('rsyslog::rsyslog_d') -%>*.conf
|
||||
|
||||
#
|
||||
# Emergencies are sent to everybody logged in.
|
||||
|
|
Загрузка…
Ссылка в новой задаче