Skip to content

Commit

Permalink
Merge pull request apsoto#4 from StudyBlue/definition
Browse files Browse the repository at this point in the history
Switch from library to definition
  • Loading branch information
apsoto committed Apr 8, 2012
2 parents b2bbee3 + 66e4d78 commit 93b7314
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
20 changes: 20 additions & 0 deletions definitions/monitrc.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# reload Reload monit so it notices the new service. :delayed (default) or :immediately.
define :monitrc, :action => :enable, :reload => :delayed do
if params[:enable]
template "/etc/monit/conf.d/#{name}.conf" do
owner "root"
group "root"
mode 0644
source "#{name}.conf.erb"
cookbook "monit"
variables params
notifies :restart, resources(:service => "monit"), params[:reload]
action :create
end
else
template "/etc/monit/conf.d/#{name}.conf" do
action :delete
notifies :restart, resources(:service => "monit"), params[:reload]
end
end
end
19 changes: 0 additions & 19 deletions libraries/monitrc.rb

This file was deleted.

8 changes: 3 additions & 5 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package "monit" do
action :install
end
package "monit"

if platform?("ubuntu")
cookbook_file "/etc/default/monit" do
Expand All @@ -12,7 +10,7 @@
end

service "monit" do
action :start
action [:enable, :start]
enabled true
supports [:start, :restart, :stop]
end
Expand All @@ -22,7 +20,7 @@
group "root"
mode 0700
source 'monitrc.erb'
notifies :restart, resources(:service => "monit"), :immediate
notifies :restart, resources(:service => "monit"), :delayed
end

directory "/etc/monit/conf.d/" do
Expand Down

0 comments on commit 93b7314

Please sign in to comment.