forked from farstarinc/puppet-module-monit
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from antonlindstrom/89a0f18f12d6b19783a4136fd40…
…1b79bb0fc5be6 Comply with puppetlabs style guide
Showing
12 changed files
with
110 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source :rubygems | ||
|
||
gem 'puppet' | ||
|
||
group :test do | ||
gem 'puppet-lint' | ||
gem 'rspec-puppet', '~> 0.1.3' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
diff-lcs (1.1.3) | ||
facter (1.6.7) | ||
puppet (2.7.13) | ||
facter (>= 1.5.1) | ||
puppet-lint (0.1.13) | ||
rspec (2.9.0) | ||
rspec-core (~> 2.9.0) | ||
rspec-expectations (~> 2.9.0) | ||
rspec-mocks (~> 2.9.0) | ||
rspec-core (2.9.0) | ||
rspec-expectations (2.9.1) | ||
diff-lcs (~> 1.1.3) | ||
rspec-mocks (2.9.0) | ||
rspec-puppet (0.1.3) | ||
rspec | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
puppet | ||
puppet-lint | ||
rspec-puppet (~> 0.1.3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'rake' | ||
|
||
require 'puppet-lint/tasks/puppet-lint' | ||
require 'rspec/core/rake_task' | ||
|
||
task :default => [:lint, :spec] | ||
|
||
RSpec::Core::RakeTask.new(:spec) do |t| | ||
t.pattern = 'spec/*/*_spec.rb' | ||
t.rspec_opts = '--color' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
class monit($ensure=present, $admin="", $interval=60) { | ||
$is_present = $ensure == "present" | ||
class monit($ensure=present, $admin='', $interval=60) { | ||
$is_present = $ensure == 'present' | ||
|
||
package { "monit": | ||
$service_pattern = $ensure ? { | ||
'present' => '/usr/sbin/monit', | ||
default => undef, | ||
} | ||
|
||
package { 'monit': | ||
ensure => $ensure, | ||
} | ||
|
||
file { | ||
"/etc/monit/monitrc": | ||
ensure => $ensure, | ||
content => template("monit/monitrc.erb"), | ||
mode => 600, | ||
require => Package["monit"]; | ||
file { '/etc/monit/monitrc': | ||
ensure => $ensure, | ||
content => template('monit/monitrc.erb'), | ||
mode => '0600', | ||
require => Package['monit'], | ||
} | ||
|
||
"/etc/default/monit": | ||
ensure => $ensure, | ||
content => "startup=1\n", | ||
require => Package["monit"]; | ||
file { '/etc/default/monit': | ||
ensure => $ensure, | ||
content => "startup=1\n", | ||
require => Package['monit'], | ||
} | ||
|
||
"/etc/logrotate.d/monit": | ||
ensure => $ensure, | ||
source => "puppet:///modules/monit/monit.logrotate", | ||
require => Package[monit]; | ||
file { '/etc/logrotate.d/monit': | ||
ensure => $ensure, | ||
source => 'puppet:///modules/monit/monit.logrotate', | ||
require => Package['monit'], | ||
} | ||
|
||
service { "monit": | ||
ensure => $is_present, | ||
enable => $is_present, | ||
hasrestart => $is_present, | ||
pattern => $ensure ? { | ||
'present' => "/usr/sbin/monit", | ||
default => undef, | ||
}, | ||
subscribe => File["/etc/monit/monitrc"], | ||
require => [File["/etc/monit/monitrc"], | ||
File["/etc/logrotate.d/monit"]], | ||
service { 'monit': | ||
ensure => $is_present, | ||
enable => $is_present, | ||
hasrestart => $is_present, | ||
pattern => $service_pattern, | ||
subscribe => File['/etc/monit/monitrc'], | ||
require => [ | ||
File['/etc/monit/monitrc'], | ||
File['/etc/logrotate.d/monit'] | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
define monit::monitor($pidfile, | ||
$ensure=present, | ||
$ip_port=0, | ||
$socket="", | ||
$socket='', | ||
$checks=[]) { | ||
|
||
file { "/etc/monit/conf.d/$name.conf": | ||
ensure => $ensure, | ||
content => template("monit/process.conf.erb"), | ||
notify => Service["monit"], | ||
require => Package["monit"], | ||
ensure => $ensure, | ||
content => template('monit/process.conf.erb'), | ||
notify => Service['monit'], | ||
require => Package['monit'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'spec_helper' | ||
|
||
describe 'monit::monitor', :type => :class do | ||
# Empty | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'spec_helper' | ||
|
||
describe 'monit', :type => :class do | ||
# Empty | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'puppet' | ||
require 'rspec' | ||
require 'rspec-puppet' | ||
|
||
def param_value(subject, type, title, param) | ||
subject.resource(type, title).send(:parameters)[param.to_sym] | ||
end | ||
|
||
RSpec.configure do |c| | ||
c.module_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/modules')) | ||
c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/manifests')) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include monit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
monit::monitor { 'ssh': | ||
pidfile => '/var/run/sshd.pid', | ||
} |