BryanDavis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/173932
Change subject: Add rsyslog module
......................................................................
Add rsyslog module
Import the rsyslog module from operations/puppet.
Change-Id: I842f72e074f2cd5bd470874aa513eee95a063aef
---
A puppet/modules/rsyslog/files/rsyslog.d-empty/README
A puppet/modules/rsyslog/manifests/conf.pp
A puppet/modules/rsyslog/manifests/init.pp
3 files changed, 91 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant
refs/changes/32/173932/1
diff --git a/puppet/modules/rsyslog/files/rsyslog.d-empty/README
b/puppet/modules/rsyslog/files/rsyslog.d-empty/README
new file mode 100644
index 0000000..93f86f8
--- /dev/null
+++ b/puppet/modules/rsyslog/files/rsyslog.d-empty/README
@@ -0,0 +1,2 @@
+This directory is managed by Puppet. Any configuration file in this directory
+that is not explicitly managed by Puppet will be purged.
diff --git a/puppet/modules/rsyslog/manifests/conf.pp
b/puppet/modules/rsyslog/manifests/conf.pp
new file mode 100644
index 0000000..6f5f7c6
--- /dev/null
+++ b/puppet/modules/rsyslog/manifests/conf.pp
@@ -0,0 +1,59 @@
+# == Define: rsyslog::conf
+#
+# Represents an rsyslogd config file. See rsyslog.conf(5).
+#
+# === Parameters
+#
+# [*content*]
+# The content of the file provided as a string. Either this or
+# 'source' must be specified.
+#
+# [*source*]
+# The content of the file provided as a puppet:/// file reference.
+# Either this or 'content' must be specified.
+#
+# [*priority*]
+# A numeric value in range 0 - 99. Files with a lower priority value
+# are evaluated first.
+#
+# If you're not sure, leave this unspecified. The default value of 60
+# should suit most cases.
+#
+# === Examples
+#
+# rsyslog::conf { 'hadoop':
+# content => template('hadoop/hadoop.conf.erb'),
+# priority => 90,
+# }
+#
+define rsyslog::conf(
+ $ensure = present,
+ $content = undef,
+ $source = undef,
+ $priority = 60
+) {
+ include ::rsyslog
+
+ if $priority !~ /^\d?\d$/ {
+ fail("'priority' must be an integer between 0 - 99 (got:
${priority}).")
+ }
+
+ $basename = regsubst($title, '[\W_]', '-', 'G')
+ $filename = sprintf('/etc/rsyslog.d/%02d-%s.conf', $priority, $basename)
+
+ # append a trailing newline if omitted
+ $content_formatted = $content ? {
+ undef => undef,
+ default => regsubst($content, "\n?$", "\n")
+ }
+
+ file { $filename:
+ ensure => $ensure,
+ content => $content_formatted,
+ source => $source,
+ owner => 'root',
+ group => 'root',
+ mode => '0444',
+ notify => Service['rsyslog'],
+ }
+}
diff --git a/puppet/modules/rsyslog/manifests/init.pp
b/puppet/modules/rsyslog/manifests/init.pp
new file mode 100644
index 0000000..bad4cac
--- /dev/null
+++ b/puppet/modules/rsyslog/manifests/init.pp
@@ -0,0 +1,30 @@
+# == Class: rsyslog
+#
+# rsyslogd is a full-featured kernel logging daemon. It is the default
+# syslogd implementation on Debian systems.
+#
+class rsyslog {
+ package { 'rsyslog':
+ ensure => present,
+ }
+
+ file { '/etc/rsyslog.d':
+ ensure => directory,
+ source => 'puppet:///modules/rsyslog/rsyslog.d-empty',
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ recurse => true,
+ purge => true,
+ force => true,
+ ignore => '50-default.conf',
+ require => Package['rsyslog'],
+ notify => Service['rsyslog'],
+ }
+
+ service { 'rsyslog':
+ ensure => running,
+ provider => 'upstart',
+ require => Package['rsyslog'],
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/173932
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I842f72e074f2cd5bd470874aa513eee95a063aef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits