Created
March 7, 2012 23:21
-
-
Save jedi4ever/1997148 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mynameis = File.read('identity').strip | |
Mccloud::Config.run do |config| | |
############################################################# | |
## ** Provider Section ** - list alls keys to be used | |
############################################################# | |
###### | |
## Example Amazon provider | |
## Defines a provider called aws-us-east | |
## Note 1: specify a provider with a different name for each region you need | |
## Note 2: you need to have a valid .fog file with the correct key and secret-key | |
config.provider.define "aws-us-east" do |provider_config| | |
provider_config.provider.flavor = :aws | |
#Note: this are option provided to fog for creation | |
provider_config.provider.options = { } | |
# Region in which to create the VM | |
provider_config.provider.region = "us-east-1" | |
## Check if necessary keypairs exist | |
## To speed things up, set it to false | |
provider_config.provider.check_keypairs = false | |
## Disable check if required security groups exist | |
## To speed things up, set it to false | |
provider_config.provider.check_security_groups = false | |
## If you share an amazon account with multiple people | |
## You can use namespaces to separate resources | |
## All resources will take this prefix | |
provider_config.provider.namespace = "prod" | |
provider_config.provider.credential = :default | |
end | |
config.provider.define "aws-us-west" do |provider_config| | |
provider_config.provider.flavor = :aws | |
#Note: this are option provided to fog for creation | |
provider_config.provider.options = { } | |
# Region in which to create the VM | |
provider_config.provider.region = "us-west-1" | |
## Check if necessary keypairs exist | |
## To speed things up, set it to false | |
provider_config.provider.check_keypairs = true | |
## Disable check if required security groups exist | |
## To speed things up, set it to false | |
provider_config.provider.check_security_groups = true | |
## If you share an amazon account with multiple people | |
## You can use namespaces to separate resources | |
## All resources will take this prefix | |
provider_config.provider.namespace = "prod" | |
provider_config.provider.credential = :atlassian | |
end | |
###### | |
## Generic provider to manage host reachable by ssh | |
config.provider.define "hosts" do |provider_config| | |
provider_config.provider.flavor = :host | |
end | |
############################################################# | |
## ** Key Section ** - list alls keys to be used | |
############################################################# | |
## Default is : | |
## - keyname = mccloud | |
## - location = in $HOME directory | |
## - private key_path = $HOME/mccloud_rsa | |
## - public key_path = $HOME/mccloud_rsa.pub | |
## | |
## Note 1: keys can be generated with '$ mccloud sshkeygen' | |
## Note 2: Amazon only supports RSA keys | |
## Note 3: You can have multiple keypair listed here | |
############################################################# | |
config.keypair.define "mccloud" 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 | |
############################################################# | |
## ** Key Store ** - defines a location to store keys in | |
############################################################# | |
## | |
## Defines a keystore provided by provider "aws-us-east" | |
## And specifies the keypair(s) to be stored in that keystore | |
## Note 1: this only handles creation, removal of keys needs to be done manual | |
## | |
## :name => "the name as visible on EC2" | |
## :pairname=> "the name specified in the Key Section of this config file" | |
############################################################# | |
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 | |
# :keypair is the named as defined above | |
{ :name => "mccloud-#{mynameis}", :keypair => "mccloud"}, | |
] | |
end | |
config.keystore.define "aws-us-west-key-store" do |keystore_config| | |
keystore_config.keystore.provider = "aws-us-west" | |
keystore_config.keystore.keypairs = [ | |
# :name is the name as it will be displayed on amazon | |
# :keypair is the named as defined above | |
{ :name => "mccloud-#{mynameis}", :keypair => "mccloud"}, | |
] | |
end | |
############################################################# | |
## ** Server section ** Specifies server options | |
## | |
## Note: Loosely modelled after Vagrantfile syntax, but not compatible | |
############################################################# | |
config.vm.define "uc-packages" do |vm_config| | |
# Provider to use for creating this vm | |
vm_config.vm.provider = "aws-us-east" | |
# AMI to use for creating the vm | |
# Debian Image - http://wiki.debian.org/Cloud/AmazonEC2Image | |
# EBS - 8GB - Squeeze | |
vm_config.vm.ami = "ami-e00df089" | |
# Flavor of the vm | |
vm_config.vm.flavor = "m1.large" | |
#vm_config.vm.flavor = "t1.micro" | |
# Availability zone to create the VM | |
vm_config.vm.zone = "us-east-1a" | |
# Security groups | |
# Note: if it starts with mccloud, it will be autocreated and port 22 will be opened | |
# Note: you can supply your own but you have to create these manual and open port 22 | |
vm_config.vm.security_groups = [ "trusted-ips"] | |
# Options required | |
# There are directly passed to fog create | |
vm_config.vm.create_options = { } | |
# User to log into the new VM created | |
vm_config.vm.user = "root" | |
vm_config.vm.agent_forwarding = "true" | |
# Path to script to execute before provisioners are run | |
# Only run on vm creation | |
vm_config.vm.bootstrap = "templates/debian-bootstrap.sh" | |
# Name of the key pair to use to login | |
vm_config.vm.key_name = "mccloud-#{mynameis}" | |
# Files to ssh into the create vm | |
vm_config.vm.private_key_path = "#{File.join(ENV['HOME'],'.ssh','mccloud_rsa')}" | |
# If no server is specified in mccloud subcommands, | |
# It will go over all server | |
# Setting auto_selection to false, will not include this server | |
vm_config.vm.auto_selection = false | |
vm_config.vm.provision :puppet do |puppet| | |
puppet.manifest_file = "uc-packages.pp.erb" | |
puppet.pp_path = "/root/puppet" | |
puppet.manifests_path = "manifests" | |
puppet.module_path = ["puppet/modules"] | |
end | |
end | |
############################################################# | |
## ** Non-server section | |
## Currently only had loadbalancer and ip-address for EC2 | |
############################################################# | |
# config.lb.define "mccloud-development-lb" do |config| | |
# config.lb.provider="aws-eu-east" | |
# config.lb.members=["aws-demo1","aws-demo1"] | |
# config.lb.sorry_members=["aws-demo2"] | |
# end | |
# | |
# config.ip.define "mccloud-demo1" do |config| | |
# config.ip.provider="aws-eu-west" | |
# config.ip.address="46.137.72.170" | |
# config.ip.vmname = "aws-demo1" | |
# end | |
end # End Mccloud |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment