Skip to content

Instantly share code, notes, and snippets.

@slantview
Created April 18, 2012 21:34
Show Gist options
  • Select an option

  • Save slantview/2416751 to your computer and use it in GitHub Desktop.

Select an option

Save slantview/2416751 to your computer and use it in GitHub Desktop.
Test vagrant file
# To Run:
# $ export ORGNAME=slantview
# $ export VAGRANT_BOX=centos6-64
# $ export VAGRANT_SHARE=~/Documents/workspace
# $ export OPSCODE_USER=slantview
# $ vagrant up
#
user = ENV['OPSCODE_USER'] || ENV['USER']
base_box = ENV['VAGRANT_BOX'] || 'centos6-64'
share = ENV['VAGRANT_SHARE'] || "."
host_name = ENV['VAGRANT_HOST_NAME'] || "#{user}-vagrant"
cwd = File.dirname(__FILE__)
if base_box == 'centos6-64'
box_url = 'http://c13313784.r84.cf2.rackcdn.com/centos-6.2-64bit-chef.0.10.8-vbox.4.1.8-3.box'
else
box_url = 'http://files.vagrantup.com/lucid32.box'
end
Vagrant::Config.run do |config|
# Set base box
config.vm.box = base_box
# Set base box url
config.vm.box_url = box_url
# Set hostname
config.vm.host_name = host_name
# Set up some ports to open up
config.vm.forward_port 80, 8080
config.vm.forward_port 443, 8443
config.vm.forward_port 3306, 3306
# Configure a share folder
config.vm.share_folder "v-data", "/data", "#{share}"
config.vm.share_folder "v-www", "/var/www/releases/_default_", "#{cwd}/../app"
config.vm.provision :chef_client do |chef|
# Set up some organization specific values based on environment variable above.
chef.chef_server_url = "http://package.workhabit.com:4000"
chef.validation_key_path = "#{cwd}/certificates/validation.pem"
chef.validation_client_name = "chef-validator"
# Change the node/client name for the Chef Server
chef.node_name = host_name
# 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
# Set to chef environment
if base_box == 'lucid32'
chef.environment = 'ubuntu'
elsif base_box == 'centos6-64'
chef.environment = 'centos'
end
# Add role "development" for dev servers.
chef.add_role("development")
# Merge our json settings.
chef.json.merge!({
:drupal => {
:htuser => "3saas",
:htpass => "3saas",
:dir => "/var/www",
:db => {
:database => "wmux_development"
}
},
:varnish => {
:listen_address => "",
:listen_port => "80"
}
})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment