Reputation: 305
I am very new to vagrant so apologies in advance for what I am sure is really obvious.
I am trying to write a vagrant file to support multiple machines. As a test I started with a very basic file:
Vagrant::configure("2") do |config|
# Use a standard box
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
# Set the Timezone to something useful
config.vm.provision :shell, :inline => "echo \"Europe/London\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"
# Update the servers
config.vm.provision :shell, :inline => "apt-get update --fix-missing"
end
This worked as expected, timezone set, updates run. So, I then went ahead with the following:
Vagrant::configure("2") do |config|
# Use a standard box
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
# Set the Timezone to something useful
config.vm.provision :shell, :inline => "echo \"Europe/London\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"
# Update the servers
config.vm.provision :shell, :inline => "apt-get update --fix-missing"
config.vm.define :lamp do |lamp|
lamp.vm.hostname = "lamp.local"
lamp.vm.network :private_network, ip: "33.33.33.10"
#lamp.vm.provision :shell, :inline => "apt-get update --fix-missing"
end
end
Unfortunately, this did not work. The box came up fine, but timezone not set, updates not run or ip set. the commented line for apt-get update was also tried with no luck. Must be something simple I am sure. Through reading the documentation, global settings should also be applied.. I guess I need to understand why they arent. Thanks Adam
Upvotes: 0
Views: 724
Reputation: 2781
With Vagrant 1.3.0, vagrant up
no longer does provisioning after the first (if you use vagrant halt
or vagrant reload
).
So you may want to try doing vagrant destroy
before vagrant up
again. There was a bug in 1.3.2 that didn't make vagrant destroy
do reprovisioning, but fixed in the next version (1.3.3).
Or you may try executing it manually vagrant provision
or vagrant up --provision
.
Upvotes: 1