Skip to content

Instantly share code, notes, and snippets.

@jasongrimes
Created June 6, 2012 01:16
Show Gist options
  • Save jasongrimes/2879240 to your computer and use it in GitHub Desktop.
Save jasongrimes/2879240 to your computer and use it in GitHub Desktop.
Sample Vagrant config file for LAMP dev environment provisioned by Chef
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.forward_port 80, 8080
config.vm.customize [
"modifyvm", :id,
"--name", "LAMP VM",
"--memory", "2048"
]
config.vm.network :hostonly, "10.0.0.23"
config.vm.share_folder("v-root", "/home/vagrant/apps", ".", :nfs => true)
# Your organization name for hosted Chef
orgname = "CHANGE_THIS_TO_YOUR_HOSTED_CHEF_ORGNAME"
# Set the Chef node ID based on environment variable NODE, if set. Otherwise default to vagrant-$USER
node = ENV['NODE']
node ||= "vagrant-#{ENV['USER']}"
config.vm.provision :chef_client do |chef|
chef.chef_server_url = "https://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.log_level = :info
chef.environment = "dev"
chef.add_role("base")
chef.add_role("webserver")
chef.add_role("db_master")
#chef.json.merge!({ :mysql_password => "foo" }) # You can do this to override any default attributes for this node.
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment