Skip to content

Instantly share code, notes, and snippets.

@pleckey
Created March 15, 2013 15:08
Show Gist options
  • Save pleckey/5170514 to your computer and use it in GitHub Desktop.
Save pleckey/5170514 to your computer and use it in GitHub Desktop.
chef solo recipe testing on Vagrant
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.customize [
"modifyvm", :id,
"--name", "chef-#{ENV['USER']}",
"--memory", "1024"
]
config.vm.network :hostonly, "10.0.0.100"
config.vm.host_name = "chef-#{ENV['USER']}"
config.vm.share_folder("local-chef-dev", "/chef", "./chef", :owner => "vagrant", :group => "vagrant")
# Set the Chef node ID based on environment variable NODE, if set. Otherwise default to cpdev-$USER
node = ENV['NODE']
node ||= "chef-#{ENV['USER']}"
config.vm.provision :chef_solo do |chef|
chef.roles_path = './chef/roles'
chef.cookbooks_path = './chef/cookbooks'
chef.data_bags_path = './chef/data_bags'
chef.encrypted_data_bag_secret_key_path = "./chef/encrypted_data_bag_secret"
chef.node_name = "#{node}"
chef.provisioning_path = "/etc/chef"
chef.log_level = :info
chef.add_role("appserver")
chef.json.merge!({ :s3cmd => { :s3_user => 'vagrant', :s3_group => 'vagrant' } })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment