Skip to content

Instantly share code, notes, and snippets.

@tknerr
Created August 21, 2012 12:13
Show Gist options
  • Save tknerr/3414976 to your computer and use it in GitHub Desktop.
Save tknerr/3414976 to your computer and use it in GitHub Desktop.
minimal mccloudfile that works with amazon aws AND hosts provider (but keypair needs to be imported first and security zones other than 'mccloud' must exist)
Mccloud::Config.run do |config|
NAME = "tkn"
# identity
config.mccloud.prefix="mccloud"
config.mccloud.environment="development"
config.mccloud.identity=NAME
# define AWS 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
# Generic provider to manage host reachable by ssh
config.provider.define "hosts" do |provider_config|
provider_config.provider.flavor = :host
end
# define VM running in AWS
config.vm.define "aws_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"
#TODO: try web_config.vm.pairname instead!
web_config.vm.key_name = "mccloud-key-#{NAME}"
web_config.vm.private_key_path = File.join(ENV['HOME'],'.ssh','mccloud_rsa')
web_config.vm.public_key_path = File.join(ENV['HOME'],'.ssh','mccloud_rsa.pub')
web_config.vm.security_groups = [ "mccloud", "web" ]
web_config.vm.create_options = { }
# TODO: is there shorter way to reference them?
web_config.vm.bootstrap="W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/mccloud-0.0.13/lib/mccloud/templates/bootstrap/bootstrap-ubuntu-system.sh"
web_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["./cookbooks"]
chef.log_level = "info"
chef.add_recipe "apache2"
chef.json.merge!({
:apache => {
:listen_ports => [ "80" ]
}
})
end
end
# define VM running on just a host
config.vm.define "host_web" do |web_config|
web_config.vm.provider = "hosts"
# web_config.vm.ip_address = "www.myserver.com"
web_config.vm.ip_address = "33.33.5.10"
web_config.vm.user = "vagrant"
web_config.vm.private_key_path = File.join(ENV['HOME'],'.vagrant.d','insecure_private_key')
# TODO: is there shorter way to reference them?
web_config.vm.bootstrap="W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/mccloud-0.0.13/lib/mccloud/templates/bootstrap/bootstrap-ubuntu-system.sh"
web_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["./cookbooks"]
chef.log_level = "info"
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