Skip to content

Instantly share code, notes, and snippets.

@harlanbarnes
Created January 17, 2012 23:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save harlanbarnes/1629785 to your computer and use it in GitHub Desktop.
Save harlanbarnes/1629785 to your computer and use it in GitHub Desktop.
Vagrantfile Multi VM
user = ENV['OPSCODE_USER'] || ENV['USER']
base_box = ENV['VAGRANT_BOX'] || 'centos-5.5-x86_64'
Vagrant::Config.run do |config|
config.vm.define :web do |web_config|
web_config.vm.box = base_box
web_config.vm.forward_port("http", 80, 8080)
web_config.vm.provision :chef_client do |chef|
chef.chef_server_url = "https://chef.imeetbeta.net"
chef.validation_key_path = "#{ENV['HOME']}/.chef/validation.pem"
chef.validation_client_name = "chef-validator"
# Change the node/client name for the Chef Server
chef.node_name = "dev-vagrant-web-#{user}"
# Put the client.rb in /etc/chef so chef-client can be run w/o specifying
chef.provisioning_path = "/etc/chef"
# logging
chef.log_level = :info
# adjust the run list to suit your testing needs
chef.run_list = [
"role[vagrant]",
"role[base]"
]
end
end
config.vm.define :db do |db_config|
db_config.vm.box = base_box
db_config.vm.forward_port("db", 3306, 3306)
db_config.vm.provision :chef_client do |chef|
chef.chef_server_url = "https://chef.imeetbeta.net"
chef.validation_key_path = "#{ENV['HOME']}/.chef/validation.pem"
chef.validation_client_name = "chef-validator"
# Change the node/client name for the Chef Server
chef.node_name = "dev-vagrant-db-#{user}"
# Put the client.rb in /etc/chef so chef-client can be run w/o specifying
chef.provisioning_path = "/etc/chef"
# logging
chef.log_level = :info
# adjust the run list to suit your testing needs
chef.run_list = [
"role[vagrant]",
"role[base]"
]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment