This repository has been archived by the owner on Nov 23, 2017. It is now read-only.
/
default.rb
66 lines (61 loc) · 1.99 KB
/
default.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# Cookbook Name:: rabbitmq
# Recipe:: default
#
# Copyright 2009, Benjamin Black
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# rabbitmq-server is not well-behaved as far as managed services goes
# we'll need to add a LWRP for calling rabbitmqctl stop
# while still using /etc/init.d/rabbitmq-server start
# because of this we just put the rabbitmq-env.conf in place and let it rip
directory "/etc/rabbitmq/" do
owner "root"
group "root"
mode 0755
action :create
end
template "/etc/rabbitmq/rabbitmq-env.conf" do
source "rabbitmq-env.conf.erb"
owner "root"
group "root"
mode 0644
notifies :restart, "service[rabbitmq-server]"
end
case node[:platform]
when "debian", "ubuntu"
# use the RabbitMQ repository instead of Ubuntu or Debian's
# because there are very useful features in the newer versions
apt_repository "rabbitmq" do
uri "http://www.rabbitmq.com/debian/"
distribution "testing"
components ["main"]
key "http://www.rabbitmq.com/rabbitmq-signing-key-public.asc"
action :add
end
package "rabbitmq-server"
when "redhat", "centos", "scientific"
remote_file "/tmp/rabbitmq-server-2.6.1-1.noarch.rpm" do
source "https://www.rabbitmq.com/releases/rabbitmq-server/v2.6.1/rabbitmq-server-2.6.1-1.noarch.rpm"
action :create_if_missing
end
rpm_package "/tmp/rabbitmq-server-2.6.1-1.noarch.rpm" do
action :install
end
end
service "rabbitmq-server" do
stop_command "/usr/sbin/rabbitmqctl stop"
action [:enable, :start]
end