summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaz <me@saz.sh>2011-07-25 14:43:14 +0200
committerSaz <me@saz.sh>2011-07-25 14:43:14 +0200
commit13a9aedb6a927963c75709d4a07391315b48c36b (patch)
tree8b48418ab4012fd3f3bce4d88bf37e7bcd68c167
initial import
-rw-r--r--files/rsyslog.conf38
-rw-r--r--files/rsyslog_default3
-rw-r--r--manifests/client.pp10
-rw-r--r--manifests/config.pp37
-rw-r--r--manifests/init.pp3
-rw-r--r--manifests/install.pp9
-rw-r--r--manifests/params.pp20
-rw-r--r--manifests/service.pp7
-rw-r--r--templates/client.conf.erb12
9 files changed, 139 insertions, 0 deletions
diff --git a/files/rsyslog.conf b/files/rsyslog.conf
new file mode 100644
index 0000000..2a0b212
--- /dev/null
+++ b/files/rsyslog.conf
@@ -0,0 +1,38 @@
+# file is managed by puppet
+
+#################
+#### MODULES ####
+#################
+
+$ModLoad imuxsock # provides support for local system logging
+$ModLoad imklog # provides kernel logging support (previously done by rklogd)
+#$ModLoad immark # provides --MARK-- message capability
+
+
+###########################
+#### GLOBAL DIRECTIVES ####
+###########################
+
+#
+# Use traditional timestamp format.
+# To enable high precision timestamps, comment out the following line.
+#
+$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+
+#
+# Set the default permissions for all log files.
+#
+$FileOwner root
+$FileGroup adm
+$FileCreateMode 0640
+$DirCreateMode 0755
+
+#
+# Include all config files in /etc/rsyslog.d/
+#
+$IncludeConfig /etc/rsyslog.d/*.conf
+
+#
+# Emergencies are sent to everybody logged in.
+#
+*.emerg *
diff --git a/files/rsyslog_default b/files/rsyslog_default
new file mode 100644
index 0000000..cba14e8
--- /dev/null
+++ b/files/rsyslog_default
@@ -0,0 +1,3 @@
+# File is managed by puppet
+
+RSYSLOGD_OPTIONS="-c4"
diff --git a/manifests/client.pp b/manifests/client.pp
new file mode 100644
index 0000000..a060413
--- /dev/null
+++ b/manifests/client.pp
@@ -0,0 +1,10 @@
+class rsyslog::client inherits rsyslog {
+ file { $rsyslog::params::client_conf:
+ owner => root,
+ group => root,
+ ensure => file,
+ content => template("${module_name}/client.conf.erb"),
+ require => Class['rsyslog::install'],
+ notify => Class['rsyslog::service'],
+ }
+}
diff --git a/manifests/config.pp b/manifests/config.pp
new file mode 100644
index 0000000..18354bf
--- /dev/null
+++ b/manifests/config.pp
@@ -0,0 +1,37 @@
+class rsyslog::config {
+ file { $rsyslog::params::rsyslog_d:
+ owner => root,
+ group => root,
+ purge => true,
+ recurse => true,
+ force => true,
+ require => Class["rsyslog::install"],
+ ensure => directory,
+ }
+
+ file { $rsyslog::params::rsyslog_conf:
+ owner => root,
+ group => root,
+ ensure => file,
+ source => "puppet:///modules/rsyslog/rsyslog.conf",
+ require => Class["rsyslog::install"],
+ notify => Class["rsyslog::service"],
+ }
+
+ file { $rsyslog::params::rsyslog_default:
+ owner => root,
+ group => root,
+ ensure => file,
+ source => "puppet:///modules/rsyslog/rsyslog_default",
+ require => Class["rsyslog::install"],
+ notify => Class["rsyslog::service"],
+ }
+
+ file { $rsyslog::params::spool_dir:
+ owner => root,
+ group => root,
+ ensure => directory,
+ require => Class["rsyslog::install"],
+ notify => Class["rsyslog::service"],
+ }
+}
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..80db400
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,3 @@
+class rsyslog {
+ include rsyslog::params, rsyslog::install, rsyslog::config, rsyslog::service
+}
diff --git a/manifests/install.pp b/manifests/install.pp
new file mode 100644
index 0000000..5521264
--- /dev/null
+++ b/manifests/install.pp
@@ -0,0 +1,9 @@
+class rsyslog::install {
+ package { $rsyslog::params::rsyslog_package_name:
+ ensure => latest,
+ }
+
+ package { $rsyslog::params::relp_package_name:
+ ensure => latest,
+ }
+}
diff --git a/manifests/params.pp b/manifests/params.pp
new file mode 100644
index 0000000..540a93e
--- /dev/null
+++ b/manifests/params.pp
@@ -0,0 +1,20 @@
+class rsyslog::params {
+ $rsyslog_server = $rsyslog_server ? {
+ '' => 'log',
+ default => $rsyslog_server,
+ }
+
+ case $operatingsystem {
+ /(Ubuntu|Debian)/: {
+ $rsyslog_package_name = 'rsyslogr'
+ $relp_package_name = 'rsyslog-relp'
+ $rsyslog_d = '/etc/rsyslog.d/'
+ $rsyslog_conf = '/etc/rsyslog.conf'
+ $rsyslog_default = '/etc/default/rsyslog'
+ $spool_dir = '/var/spool/rsyslog/'
+ $service_name = 'rsyslog'
+ $client_conf = "${rsyslog_d}client.conf"
+ $server_conf = "${rsyslog_d}server.conf"
+ }
+ }
+}
diff --git a/manifests/service.pp b/manifests/service.pp
new file mode 100644
index 0000000..66c03dc
--- /dev/null
+++ b/manifests/service.pp
@@ -0,0 +1,7 @@
+class rsyslog::service {
+ service { $rsyslog::params::service_name:
+ ensure => running,
+ enable => true,
+ require => Class["rsyslog::config"],
+ }
+}
diff --git a/templates/client.conf.erb b/templates/client.conf.erb
new file mode 100644
index 0000000..7e123a3
--- /dev/null
+++ b/templates/client.conf.erb
@@ -0,0 +1,12 @@
+# file is managed by puppet
+
+# An "In-Memory Queue" is created for remote logging.
+$WorkDirectory /var/spool/rsyslog # where to place spool files
+$ActionQueueFileName queue # unique name prefix for spool files
+$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
+$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
+$ActionQueueType LinkedList # run asynchronously
+$ActionResumeRetryCount -1 # infinety retries if host is down
+
+$ModLoad omrelp
+*.* :omrelp:<%= scope.lookupvar('rsyslog::params::rsyslog_server') %>:2514;RSYSLOG_ForwardFormat