default.rb 1.58 KB
Newer Older
Adam Jacob's avatar
Adam Jacob committed
1
#
Tim Smith's avatar
Tim Smith committed
2
# Cookbook:: runit
Adam Jacob's avatar
Adam Jacob committed
3 4
# Recipe:: default
#
Tim Smith's avatar
Tim Smith committed
5
# Copyright:: 2008-2016, Chef Software, Inc.
Adam Jacob's avatar
Adam Jacob committed
6
#
7
# Licensed under the Apache License, Version 2.0 (the 'License');
Adam Jacob's avatar
Adam Jacob committed
8 9
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
10
#
Adam Jacob's avatar
Adam Jacob committed
11
#     http://www.apache.org/licenses/LICENSE-2.0
12
#
Adam Jacob's avatar
Adam Jacob committed
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an 'AS IS' BASIS,
Adam Jacob's avatar
Adam Jacob committed
15 16 17 18 19
# 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.
#

20
service 'runit' do
21
  action :nothing
22
end
23

24
execute 'start-runsvdir' do
25
  command '/etc/init.d/runit-start start'
Paul Graydon's avatar
Paul Graydon committed
26 27 28
  action :nothing
end

29
case node['platform_family']
Tim Smith's avatar
Tim Smith committed
30
when 'rhel', 'amazon'
31

Tim Smith's avatar
Tim Smith committed
32 33 34 35
  # add the necessary repos unless prefer_local_yum is set
  unless node['runit']['prefer_local_yum']
    include_recipe 'yum-epel' if node['platform_version'].to_i < 7

36
    packagecloud_repo 'imeyer/runit' do
37
      force_os 'rhel' if platform?('oracle', 'amazon') # ~FC024
Tim Smith's avatar
Tim Smith committed
38 39
      force_dist '6' if platform?('amazon')
      type 'rpm' if platform?('amazon')
40
    end
Tim Smith's avatar
Tim Smith committed
41
  end
42

43
  package 'runit'
44

Cameron Johnston's avatar
Cameron Johnston committed
45 46 47
  service 'runsvdir-start' do
    action [:start, :enable]
    only_if { node['platform_version'].to_i == 7 }
48 49
  end

Tim Smith's avatar
Tim Smith committed
50
when 'debian'
51
  package 'runit' do
Adam Jacob's avatar
Adam Jacob committed
52
    action :install
Tim Smith's avatar
Tim Smith committed
53
    response_file 'runit.seed'
Adam Jacob's avatar
Adam Jacob committed
54
  end
55 56 57 58 59 60

  execute 'runsvdir-start' do
    command '/etc/runit/2 &'
    not_if 'ps -ef | grep -v grep | grep "runsvdir"'
    only_if { platform?('debian') && node['platform_version'].to_i >= 9 }
  end
Adam Jacob's avatar
Adam Jacob committed
61
end