Skip to content

Instantly share code, notes, and snippets.

@tknerr
Created July 25, 2012 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tknerr/3175267 to your computer and use it in GitHub Desktop.
Save tknerr/3175267 to your computer and use it in GitHub Desktop.
Minimal Mccloudfile: trying to reduce this to the minimum necessary in order to provision an ec2 instance using Chef-solo
Mccloud::Config.run do |config|
NAME = "tkn"
# identity
config.mccloud.prefix="mccloud"
config.mccloud.environment="development"
config.mccloud.identity=NAME
# define cloud provider
config.provider.define "aws-us-east" do |provider_config|
provider_config.provider.flavor = :aws
provider_config.provider.options = { }
provider_config.provider.region = "us-east-1"
provider_config.provider.check_keypairs = true
provider_config.provider.check_security_groups = true
provider_config.provider.namespace = "mccloud-development"
end
# define key pairs
config.keypair.define "mccloud-keypair-#{NAME}" do |key_config|
key_config.keypair.public_key_path = "#{File.join(ENV['HOME'],'.ssh','mccloud_rsa.pub')}"
key_config.keypair.private_key_path = "#{File.join(ENV['HOME'],'.ssh','mccloud_rsa')}"
end
# define keystore
config.keystore.define "aws-us-east-key-store" do |keystore_config|
keystore_config.keystore.provider = "aws-us-east"
keystore_config.keystore.keypairs = [
# :name is the name as it will be displayed on amazon
# :pairname is the named as defined above
{ :name => "mccloud-key-#{NAME}", :pairname => "mccloud-keypair-#{NAME}"},
]
end
config.vm.define "web" do |web_config|
web_config.vm.provider= "aws-us-east"
web_config.vm.ami = "ami-3c994355"
web_config.vm.flavor = "m1.small"
web_config.vm.zone = "us-east-1a"
web_config.vm.user="ubuntu"
web_config.vm.key_name = "mccloud-key-#{NAME}"
# XXX: should not be necessary as we defined them in the keystore above already?
web_config.vm.private_key_path="W:/home/.ssh/mccloud_rsa"
web_config.vm.public_key_path="W:/home/.ssh/mccloud_rsa.pub"
web_config.vm.security_groups = [ "mccloud"]
web_config.vm.create_options = { }
web_config.vm.bootstrap="bootstrap/bootstrap-ubuntu-system.sh"
web_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["./cookbooks"]
chef.log_level = "debug"
chef.add_recipe "apache2"
chef.json.merge!({
:apache => {
:listen_ports => [ "80" ]
}
})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment