I am wondering if there is a way to specify default values ββfor conductors when creating a layered environment using Vagrant?
I tried to do something like the following:
Vagrant.configure("2") do |config| config.vm.box = "andyshinn/ubuntu-precise64" config.vm.provision :chef_client do |chef| chef.chef_server_url = "https://api.opscode.com/organizations/myorg" chef.validation_key_path = "~/.chef/myorg-validator.pem" chef.delete_node = true chef.delete_client = true chef.validation_client_name = "myorg-validator" end config.vm.define :app do |app| app.vm.network "private_network", ip: "172.16.64.61" app.vm.host_name = "vagrant-app-#{ENV['USER']}" app.vm.provision :chef_client do |chef| chef.add_recipe "myrecipe1" chef.add_recipe "myrecipe2" chef.add_recipe "sudo" end end config.vm.define :web do |web| web.vm.network "private_network", ip: "172.16.64.62" web.vm.host_name = "vagrant-web-#{ENV['USER']}" web.vm.provision :chef_client do |chef| chef.add_recipe "myrecipe3" chef.add_recipe "myrecipe4" chef.add_recipe "sudo" end end end
But each VM block does not seem to pick up any of the basic settings of the configuration block. I get this error:
There are errors in the configuration of this machine. Please fix the following errors and try again: chef client provisioner: * Chef server URL must be populated. * Validation key path must be valid path to your chef server validation key.
Perhaps using another method?
vagrant vagrantfile
Andy shinn
source share