Skip to content

Instantly share code, notes, and snippets.

@deadkarma
Forked from emachnic/default.rb
Created March 20, 2012 20:45
Show Gist options
  • Save deadkarma/2141091 to your computer and use it in GitHub Desktop.
Save deadkarma/2141091 to your computer and use it in GitHub Desktop.
Chef recipe to write redis.yml on Engine Yard Cloud
# ey-cloud-recipes/cookbooks/redis-yml/recipes/default.rb
if ['app_master', 'app'].include?(node[:instance_role])
redis_instance = node['utility_instances'].find { |instance| instance['name'] == 'redis' }
if redis_instance
node[:applications].each do |app, data|
template "/data/#{app}/shared/config/redis.yml"do
source 'redis.yml.erb'
owner node[:owner_name]
group node[:owner_name]
mode 0655
backup 0
variables({
:environment => node[:environment][:framework_env],
:hostname => redis_instance[:hostname]
})
end
end
end
end
# ey-cloud-recipes/cookbooks/redis-yml/templates/default/redis.yml.erb
<%= @environment %>:
host: <%= @hostname %>
port: 6379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment