Skip to content

Instantly share code, notes, and snippets.

@Aslan
Created November 7, 2011 23:28
Show Gist options
  • Save Aslan/1346539 to your computer and use it in GitHub Desktop.
Save Aslan/1346539 to your computer and use it in GitHub Desktop.
require 'ohai'
require 'json'
o = Ohai::System.new
o.all_plugins
chef_config = JSON.parse(o[:ec2][:userdata])
if chef_config.kind_of?(Array)
chef_config = chef_config[o[:ec2][:ami_launch_index]]
end
Chef::Log.info(chef_config["app_role"])
if chef_config["app_role"] == "primary"
execute "start delayed job daemon" do
cwd "#{node[:deploy_root]}/current"
command "script/delayed_job start"
user "amsrv"
end
execute "whenever script " do
#....
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment