Skip to content

Instantly share code, notes, and snippets.

@jtimberman
jtimberman / default_spec.rb
Created May 10, 2013 03:14
this is cookbooks/java/spec/default_spec.rb. Then install the chefspec gem and run rspec. (yay!)
require 'chefspec'
describe 'java::default' do
let (:chef_run) { ChefSpec::ChefRunner.new.converge('java::default') }
it 'should include the openjdk recipe by default' do
chef_run.should include_recipe 'java::openjdk'
end
context 'windows' do
let(:chef_run) do
@ranjib
ranjib / berkshelf_error.txt
Created March 14, 2013 09:01
berkshelf error
[berkshefl] $ berks upload
Using apache2 (1.6.0)
Using java (1.10.0)
Using yum (2.1.0)
Using s3cmd (0.0.0) at path: 'site-cookbooks/s3cmd'
Using as_app (0.0.3) at path: 'site-cookbooks/as_app'
Using rabbitmq (0.0.0) at path: 'site-cookbooks/rabbitmq'
Using solr (0.0.0) at path: 'site-cookbooks/solr'
Using windows (1.8.4)
Using chef_handler (1.1.4)
@garnaat
garnaat / gist:2917662
Created June 12, 2012 13:55
Example using boto to create an IAM role and associate it with an EC2 instance
In [1]: policy = """{
...: "Statement":[{
...: "Effect":"Allow",
...: "Action":["s3:*"],
...: "Resource":["arn:aws:s3:::mybucket"]}]}"""
In [2]: import boto
In [4]: c = boto.connect_iam()
In [5]: instance_profile = c.create_instance_profile('myinstanceprofile')
In [6]: role = c.create_role('myrole')
In [7]: c.add_role_to_instance_profile('myinstanceprofile', 'myrole')