Skip to content

Commit d03aaa1

Browse files
committed
Adding new puppet module pernimsoft
1 parent ce850a1 commit d03aaa1

File tree

8 files changed

+170
-0
lines changed

8 files changed

+170
-0
lines changed

pernimsoft/Modulefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name 'jag-pernimsoft'
2+
version '0.1.0'
3+
source 'UNKNOWN'
4+
author 'jag'
5+
license 'Apache License, Version 2.0'
6+
summary 'UNKNOWN'
7+
description 'UNKNOWN'
8+
project_page 'UNKNOWN'
9+
10+
## Add dependencies, if any:
11+
# dependency 'username/name', '>= 1.2.0'

pernimsoft/README

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pernimsoft
2+
3+
This is the pernimsoft module.
4+
5+
License
6+
-------
7+
8+
9+
Contact
10+
-------
11+
12+
13+
Support
14+
-------
15+
16+
Please log tickets and issues at our [Projects site](http://projects.example.com)

pernimsoft/files/syslog.rhel5

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/var/log/messages /var/log/cron {
2+
sharedscripts
3+
weekly
4+
create 0640 root nimsoft
5+
rotate 4
6+
postrotate
7+
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
8+
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
9+
endscript
10+
}
11+
/var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log {
12+
sharedscripts
13+
postrotate
14+
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
15+
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
16+
endscript
17+
}

pernimsoft/files/syslog.rhel6

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/var/log/cron
2+
{
3+
weekly
4+
dateext
5+
create 0640 root nimsoft
6+
rotate 4
7+
}
8+
/var/log/messages
9+
{
10+
weekly
11+
dateext
12+
create 0640 root nimsoft
13+
rotate 4
14+
}
15+
/var/log/secure
16+
/var/log/maillog
17+
/var/log/spooler
18+
{
19+
sharedscripts
20+
postrotate
21+
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
22+
endscript
23+
}

pernimsoft/manifests/init.pp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# == Class: pernimsoft
2+
#
3+
# Full description of class pernimsoft here.
4+
#
5+
# === Parameters
6+
#
7+
# Document parameters here.
8+
#
9+
# [*sample_parameter*]
10+
# Explanation of what this parameter affects and what it defaults to.
11+
# e.g. "Specify one or more upstream ntp servers as an array."
12+
#
13+
# === Variables
14+
#
15+
# Here you should define a list of variables that this module would require.
16+
#
17+
# [*sample_variable*]
18+
# Explanation of how this variable affects the funtion of this class and if
19+
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
20+
# External Node Classifier as a comma separated list of hostnames." (Note,
21+
# global variables should be avoided in favor of class parameters as
22+
# of Puppet 2.6.)
23+
#
24+
# === Examples
25+
#
26+
# class { pernimsoft:
27+
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
28+
# }
29+
#
30+
# === Authors
31+
#
32+
# Author Name <[email protected]>
33+
#
34+
# === Copyright
35+
#
36+
# Copyright 2020 Your name here, unless otherwise noted.
37+
#
38+
class pernimsoft {
39+
case $osfamily {
40+
'RedHat', 'CentOS': { include pernimsoft::redhat }
41+
default: { notify{"This action is not supported, Nothing to do.... : module-pernimsoft-generic-action": } }
42+
}
43+
44+
45+
46+
}
47+

pernimsoft/manifests/redhat.pp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class pernimsoft::redhat inherits pernimsoft {
2+
case $operatingsystemmajrelease {
3+
'5': { file { '/etc/logrotate.d/syslog':
4+
ensure => file,
5+
owner => 'root',
6+
group => 'root',
7+
mode => 0644,
8+
source => 'puppet:///modules/pernimsoft/syslog.rhel5',
9+
notify => Exec['runlogrotate'], }
10+
}
11+
'6': { file { '/etc/logrotate.d/syslog':
12+
ensure => file,
13+
owner => 'root',
14+
group => 'root',
15+
mode => 0644,
16+
source => 'puppet:///modules/pernimsoft/syslog.rhel6',
17+
notify => Exec['runlogrotate'], }
18+
}
19+
default: { notify{"This action is not supported, Nothing to do.... : module-pernimsoft-generic-action": } }
20+
}
21+
22+
exec { 'runlogrotate':
23+
command => 'logrotate -f /etc/logrotate.conf',
24+
path => ['/usr/bin', '/usr/sbin',],
25+
refreshonly => true,
26+
}
27+
}

pernimsoft/spec/spec_helper.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
dir = File.expand_path(File.dirname(__FILE__))
2+
$LOAD_PATH.unshift File.join(dir, 'lib')
3+
4+
require 'mocha'
5+
require 'puppet'
6+
require 'rspec'
7+
require 'spec/autorun'
8+
9+
Spec::Runner.configure do |config|
10+
config.mock_with :mocha
11+
end
12+
13+
# We need this because the RAL uses 'should' as a method. This
14+
# allows us the same behaviour but with a different method name.
15+
class Object
16+
alias :must :should
17+
end

pernimsoft/tests/init.pp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The baseline for module testing used by Puppet Labs is that each manifest
2+
# should have a corresponding test manifest that declares that class or defined
3+
# type.
4+
#
5+
# Tests are then run by using puppet apply --noop (to check for compilation
6+
# errors and view a log of events) or by fully applying the test in a virtual
7+
# environment (to compare the resulting system state to the desired state).
8+
#
9+
# Learn more about module testing here:
10+
# http://docs.puppetlabs.com/guides/tests_smoke.html
11+
#
12+
include pernimsoft

0 commit comments

Comments
 (0)