diff --git a/README.md b/README.md index a1e878d..98ca5b6 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,17 @@ for the exact matrix of supported Puppet and ruby versions. * EL 5 * EL 6 * EL 7 + * EL 8 [*] * Suse 10 * Suse 11 * Suse 12 + * Suse 15 * Solaris 10 * Solaris 11 +[*] This module support the `basic` configuration format for rsyslog. + EL 8 by default utilize the `advanced` configuration format but is compatible with `basic` configurations as well. + === # Examples diff --git a/manifests/init.pp b/manifests/init.pp index 92eb83f..f065562 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -202,8 +202,15 @@ $default_mod_imjournal = true $default_manage_devlog = true } + /^8\.*/: { + $default_pid_file = '/var/run/syslogd.pid' + $sysconfig_erb = 'sysconfig.rhel8.erb' + $default_syslogd_options = undef + $default_mod_imjournal = true + $default_manage_devlog = true + } default: { - fail("rsyslog supports RedHat like systems with major release of 5, 6 and 7 and you have ${::operatingsystemrelease}") + fail("rsyslog supports RedHat like systems with major release of 5, 6, 7 and 8 and you have ${::operatingsystemrelease}") } } # ensures that sysklogd is absent, which is needed on EL5 @@ -237,8 +244,11 @@ /^12\.*/ : { $sysconfig_erb = 'sysconfig.suse12.erb' } + /^15\.*/ : { + $sysconfig_erb = 'sysconfig.suse15.erb' + } default: { - fail("rsyslog supports Suse like systems with major release 10 and 11, and you have ${::operatingsystemrelease}") + fail("rsyslog supports Suse like systems with major release 10, 11, 12 and 15, and you have ${::operatingsystemrelease}") } } } diff --git a/metadata.json b/metadata.json index 4fc7f82..92eb2a7 100644 --- a/metadata.json +++ b/metadata.json @@ -23,7 +23,8 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { @@ -31,7 +32,8 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { @@ -39,7 +41,8 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { @@ -47,14 +50,27 @@ "operatingsystemrelease": [ "5", "6", - "7" + "7", + "8" ] }, { - "operatingsystem": "SLES" + "operatingsystem": "SLES", + "operatingsystemrelease": [ + "10", + "11", + "12", + "15" + ] }, { - "operatingsystem": "SLED" + "operatingsystem": "SLED", + "operatingsystemrelease": [ + "10", + "11", + "12", + "15" + ] }, { "operatingsystem": "Solaris", diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index ff92857..e0f44df 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -805,10 +805,12 @@ 'redhat5' => { :osfamily => 'RedHat', :release => '5.10', :kernel => 'Linux', }, 'redhat6' => { :osfamily => 'RedHat', :release => '6.5', :kernel => 'Linux', }, 'redhat7' => { :osfamily => 'RedHat', :release => '7.0.1406', :kernel => 'Linux', }, + 'redhat8' => { :osfamily => 'RedHat', :release => '8.0', :kernel => 'Linux', }, 'debian7' => { :osfamily => 'Debian', :release => '7.3', :kernel => 'Linux', }, 'suse10' => { :osfamily => 'Suse', :release => '10.1', :kernel => 'Linux', }, 'suse11' => { :osfamily => 'Suse', :release => '11.1', :kernel => 'Linux', }, 'suse12' => { :osfamily => 'Suse', :release => '12.1', :kernel => 'Linux', }, + 'suse15' => { :osfamily => 'Suse', :release => '15.1', :kernel => 'Linux', }, 'solaris10' => { :osfamily => 'Solaris', :release => '5.10', :kernel => 'Solaris', }, 'solaris11' => { :osfamily => 'Solaris', :release => '5.11', :kernel => 'Solaris', }, } @@ -1081,6 +1083,36 @@ end end + context 'on EL 8' do + let :facts do + { + :kernel => 'Linux', + :osfamily => 'RedHat', + :operatingsystemrelease => '8.0', + } + end + + context 'with default params' do + it { + should contain_file('rsyslog_sysconfig').with({ + 'path' => '/etc/sysconfig/rsyslog', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'require' => 'Package[rsyslog]', + 'notify' => 'Service[rsyslog_daemon]', + }) + } + it { should contain_file('rsyslog_sysconfig').with_content(/^SYSLOGD_OPTIONS=""$/) } + end + + context 'with syslogd_options specified as valid value' do + let(:params) { { :syslogd_options => '-c0' } } + + it { should contain_file('rsyslog_sysconfig').with_content(/^SYSLOGD_OPTIONS="-c0"$/) } + end + end + context 'on Suse 10' do let :facts do { @@ -1182,6 +1214,36 @@ it { should contain_file('rsyslog_sysconfig').with_content(/^RSYSLOGD_PARAMS="-c0"$/) } end end + + context 'on Suse 15' do + let :facts do + { + :kernel => 'Linux', + :osfamily => 'Suse', + :operatingsystemrelease => '15.0', + } + end + + context 'with default params' do + it { + should contain_file('rsyslog_sysconfig').with({ + 'path' => '/etc/sysconfig/syslog', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'require' => 'Package[rsyslog]', + 'notify' => 'Service[rsyslog_daemon]', + }) + } + it { should contain_file('rsyslog_sysconfig').with_content(/^RSYSLOGD_PARAMS=""$/) } + end + + context 'with syslogd_options specified as valid value' do + let(:params) { { :syslogd_options => '-c0' } } + + it { should contain_file('rsyslog_sysconfig').with_content(/^RSYSLOGD_PARAMS="-c0"$/) } + end + end end describe 'rsyslog_d_dir' do @@ -1368,11 +1430,13 @@ 'redhat5' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '5.10', :support => 'supported', }, 'redhat6' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '6.5', :support => 'supported', }, 'redhat7' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '7.0.1406', :support => 'supported', }, + 'redhat8' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '8.0', :support => 'supported', }, 'debian7' => { :kernel => 'Linux', :osfamily => 'Debian', :release => '7.3', :support => 'supported', }, 'suse9' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '9.1', :support => 'unsupported', }, 'suse10' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '10.2', :support => 'supported', }, 'suse11' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '11.1', :support => 'supported', }, 'suse12' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '12.1', :support => 'supported', }, + 'suse15' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '15.1', :support => 'supported', }, 'solaris9' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.9', :support => 'unsupported', }, 'solaris10' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.10', :support => 'supported', }, 'solaris11' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.11', :support => 'supported', }, @@ -1416,10 +1480,12 @@ 'redhat5' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '5', :mod_imjournal => false, }, 'redhat6' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '6', :mod_imjournal => false, }, 'redhat7' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '7', :mod_imjournal => true, }, + 'redhat8' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '8', :mod_imjournal => true, }, 'debian7' => { :kernel => 'Linux', :osfamily => 'Debian', :release => '7', :mod_imjournal => false, }, 'suse10' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '10', :mod_imjournal => false, }, 'suse11' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '11', :mod_imjournal => false, }, 'suse12' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '12', :mod_imjournal => false, }, + 'suse15' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '15', :mod_imjournal => false, }, 'solaris10' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.10', :mod_imjournal => false, }, 'solaris11' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.11', :mod_imjournal => false, }, } @@ -1457,10 +1523,12 @@ 'redhat5' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '5', :manage_devlog => false, }, 'redhat6' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '6', :manage_devlog => false, }, 'redhat7' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '7', :manage_devlog => true, }, + 'redhat8' => { :kernel => 'Linux', :osfamily => 'RedHat', :release => '8', :manage_devlog => true, }, 'debian7' => { :kernel => 'Linux', :osfamily => 'Debian', :release => '7', :manage_devlog => false, }, 'suse10' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '10', :manage_devlog => false, }, 'suse11' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '11', :manage_devlog => false, }, 'suse12' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '12', :manage_devlog => false, }, + 'suse15' => { :kernel => 'Linux', :osfamily => 'Suse', :release => '15', :manage_devlog => false, }, 'solaris10' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.10', :manage_devlog => false, }, 'solaris11' => { :kernel => 'Solaris', :osfamily => 'Solaris', :release => '5.11', :manage_devlog => false, }, } diff --git a/spec/fixtures/logrotate.redhat8 b/spec/fixtures/logrotate.redhat8 new file mode 100644 index 0000000..ff4ebc3 --- /dev/null +++ b/spec/fixtures/logrotate.redhat8 @@ -0,0 +1,15 @@ +# This file is being maintained by Puppet. +# DO NOT EDIT + +/var/log/messages +/var/log/secure +/var/log/maillog +/var/log/spooler +/var/log/boot.log +/var/log/cron +{ + sharedscripts + postrotate + /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + endscript +} diff --git a/spec/fixtures/logrotate.suse15 b/spec/fixtures/logrotate.suse15 new file mode 100644 index 0000000..7c79eef --- /dev/null +++ b/spec/fixtures/logrotate.suse15 @@ -0,0 +1,36 @@ +# This file is being maintained by Puppet. +# DO NOT EDIT + +/var/log/messages +/var/log/secure +/var/log/maillog +/var/log/spooler +/var/log/boot.log +/var/log/cron +/var/log/warn +/var/log/allmessages +/var/log/localmessages +/var/log/firewall +/var/log/acpid +/var/log/NetworkManager +/var/log/mail +/var/log/mail.info +/var/log/mail.warn +/var/log/mail.err +/var/log/news/news.crit +/var/log/news/news.err +/var/log/news/news.notice +{ + compress + dateext + maxage 365 + rotate 99 + missingok + notifempty + size +4096k + create 640 root root + sharedscripts + postrotate + /sbin/service syslog reload > /dev/null + endscript +} diff --git a/templates/sysconfig.rhel8.erb b/templates/sysconfig.rhel8.erb new file mode 100644 index 0000000..28454e1 --- /dev/null +++ b/templates/sysconfig.rhel8.erb @@ -0,0 +1,8 @@ +# This file is being maintained by Puppet. +# DO NOT EDIT +# +# Options for rsyslogd +# Syslogd options are deprecated since rsyslog v3. +# If you want to use them, switch to compatibility mode 2 by "-c 2" +# See rsyslogd(8) for more details +SYSLOGD_OPTIONS="<%= @syslogd_options_real %>" diff --git a/templates/sysconfig.suse15.erb b/templates/sysconfig.suse15.erb new file mode 100644 index 0000000..8b27bef --- /dev/null +++ b/templates/sysconfig.suse15.erb @@ -0,0 +1,18 @@ +# This file is being maintained by Puppet. +# DO NOT EDIT + +## Type: string +## Default: "" +## Config: "" +## ServiceRestart: syslog +# +# Parameters for rsyslogd, except of the version compatibility (-c) +# and the config file (-f), because they're used by sysconfig and +# earlysysconfig init scripts. +# +# See also the RSYSLOGD_COMPAT_VERSION variable in this file, the +# documentation provided in /usr/share/doc/packages/rsyslog/doc by +# the rsyslog-doc package and the rsyslogd(8) and rsyslog.conf(5) +# manual pages. +# +RSYSLOGD_PARAMS="<%= @syslogd_options_real %>"