Skip to content

Instantly share code, notes, and snippets.

@deepakprasanna
Created November 20, 2012 23:57
Show Gist options
  • Save deepakprasanna/4122103 to your computer and use it in GitHub Desktop.
Save deepakprasanna/4122103 to your computer and use it in GitHub Desktop.
#Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "precise32"
config.vm.forward_port 80, 8080
config.vm.customize [
"modifyvm", :id,
"--name", "LAMP VM",
"--memory", "2048"
]
config.vm.network :bridged
config.vm.host_name = "lamp-vm"
#config.vm.share_folder("v-root", "/home/vagrant/apps", ".", :nfs => true)
orgname = "thoughtster"
node = ENV["NODE"] || "vagrant-#{ENV['USER']}"
config.vm.provision :shell, :inline => "gem install chef"
config.vm.provision :chef_client do |chef|
chef.chef_server_url = "http://api.opscode.com/organizations/#{orgname}"
chef.validation_key_path = "#{ENV['HOME']}/.chef/#{orgname}-validator.pem"
chef.validation_client_name = "#{orgname}-validator"
chef.encrypted_data_bag_secret_key_path = "#{ENV['HOME']}/.chef/encrypted_data_bag_secret"
chef.node_name = node
chef.provisioning_path = "/etc/chef"
chef.log_level = :debug
chef.environment = "dev"
chef.add_role("base")
chef.add_role("db_master")
chef.add_role("webmaster")
end
end
#knife.rb
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "thoughtster"
client_key "#{current_dir}/thoughtster.pem"
validation_client_name "thoughtster-validator"
validation_key "#{current_dir}/thoughtster-validator.pem"
chef_server_url "https://api.opscode.com/organizations/thoughtster"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path "./cookbooks"
cookbook_copyright "Deepak Prasanna Ramaswami"
cookbook_email "deepak@systeminsights.com"
cookbook_license "apachev2"
encrypted_data_bag_secret "#{current_dir}/encrypted_data_bag_secret"
knife[:aws_access_key_id] = "xxxxxxxxxxxxxxxxxxxxxxxx"
knife[:aws_secret_access_key] = "xxxxxxxxxxxxxxxxxxxxx"
#Things inside .chef directory
[ruby-1.9.3-p286] ~/.chef ls
checksums encrypted_data_bag_secret knife.rb thoughtster.pem thoughtster-validator.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment