# This module is distributed under the GNU Affero General Public License: # # Syslog-ng module for puppet # Copyright (C) 2009 Sarava Group # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . class syslog-ng( $log_kernel_msgs = hiera('syslog-ng::log_kernel_msgs', true), $ensure = 'present' ) { # see https://bugs.launchpad.net/ubuntu/+source/syslog-ng/+bug/1242173 package { 'syslog-ng-core': ensure => $ensure, } package { 'syslog-ng': ensure => $ensure, require => Package['syslog-ng-core'], } # syslog-ng service service { "syslog-ng": enable => $ensure ? { 'present' => true, default => false, }, ensure => $ensure ? { 'present' => running, default => stopped, }, hasrestart => true, hasstatus => false, # Somehow syslog-ng is not returning if it was killed due to lack of # memory or other issue. A simple start is not enough and we need to # ensure it's properly stopped first. restart => '/etc/init.d/syslog-ng stop; /etc/init.d/syslog-ng start', pattern => '/usr/sbin/syslog-ng', require => File["/etc/syslog-ng/syslog-ng.conf"], } # config file file { "/etc/syslog-ng/syslog-ng.conf": content => template("syslog-ng/syslog-ng.conf_${lsbdistcodename}.erb"), owner => "root", group => "root", mode => 0644, ensure => $ensure, notify => Service["syslog-ng"], require => File["/etc/syslog-ng"], } # config folder file { "/etc/syslog-ng": ensure => $ensure ? { 'present' => directory, default => absent, }, force => $ensure ? { 'present' => undef, default => true, }, owner => "root", group => "root", require => Package["syslog-ng"], } }