Skip to content

Commit

Permalink
add disable_os_default recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
alepore committed Oct 19, 2016
1 parent 8c7b972 commit d7c831b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Recipes
* redis_gem - This recipe can be used to install the redis ruby gem
* sentinel - This recipe can be used to install and configure sentinel
* sentinel_enable - This recipe can be used to enable the sentinel service(s)
* disable_os_default - This recipe can be used to disable the default OS redis init script

Role File Examples
------------------
Expand Down
1 change: 1 addition & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
recipe 'redisio::enable', 'This recipe is used to start the redis instances and enable them in the default run levels'
recipe 'redisio::disable', 'this recipe is used to stop the redis instances and disable them in the default run levels'
recipe 'redisio::redis_gem', 'this recipe will install the redis ruby gem into the system ruby'
recipe 'redisio::disable_os_default', 'This recipe is used to disable the default OS redis init script'

depends 'ulimit', '>= 0.1.2'
depends 'build-essential'
32 changes: 32 additions & 0 deletions recipes/disable_os_default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Cookbook Name:: redisio
# Recipe:: disable_os_default
#
# Copyright 2013, Brian Bianco <brian.bianco@gmail.com>
#
#
# 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.
#

# disable the default OS redis init script
service_name = case node['platform']
when 'debian', 'ubuntu'
'redis-server'
when 'redhat', 'centos', 'fedora', 'scientific', 'suse', 'amazon'
'redis'
end

service service_name do
action [:stop, :disable]
only_if { service_name }
end

0 comments on commit d7c831b

Please sign in to comment.