hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.27k stars 4.43k forks source link

Multi VM Setup does not re-execute provisioning #2279

Closed neovatar closed 11 years ago

neovatar commented 11 years ago

I am using Vagrant 1.3.3 x86_64 on Ubuntu 12.04 with Virtual Box 4.2.18

I have the following Vagrantfile:

Vagrant.configure('2') do |config|

  box_name = 'precise-server-cloudimg-vagrant-amd64'
  box_url = 'http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box'

  server_name = 'szid-ciserver-1'
  server_ip = '33.33.34.10'
  config.vm.define server_name do |server|
    #server.berkshelf.enabled = true
    server.vm.box = box_name
    server.vm.box_url = box_url
    server.vm.hostname = server_name
    server.vm.network :private_network, ip: server_ip
    server.vm.provider 'virtualbox' do |v|
      v.customize ['modifyvm', :id, '--memory', '2048']
    end
    server.vm.provision :shell, :path => 'bootstrap.sh', :args => "'#{server_name}' '#{server_ip}'"
  end
end

The problem is, that after the initial vagrant up szid-ciserver-1 a vagrant reload szid-ciserver-1 or vagrant halt szid-ciserver-1 followed by vagrant up szid-ciserver-1 does not re-run provisioning. This also happens with chef-solo provisioning. If i remove the file _.vagrant/machines/szid-ciserver-1/virtualbox/actionprovision then provisioning will run once again. Is this intended behaviour? It was different with Vagrant <= 1.2.2

canausa commented 11 years ago

In version 1.3+ provisioning will only run on the first up, if you want it to run again use vagrant provision.

On Thu, Sep 26, 2013 at 10:37 AM, Thomas Seliger notifications@github.comwrote:

I am using Vagrant 1.3.3 x86_64 on Ubuntu 12.04 with Virtual Box 4.2.18

I have the following Vagrantfile:

Vagrant.configure('2') do |config|

box_name = 'precise-server-cloudimg-vagrant-amd64' box_url = 'http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box'

server_name = 'szid-ciserver-1' server_ip = '33.33.34.10' config.vm.define server_name do |server|

server.berkshelf.enabled = true

server.vm.box = box_name
server.vm.box_url = box_url
server.vm.hostname = server_name
server.vm.network :private_network, ip: server_ip
server.vm.provider 'virtualbox' do |v|
  v.customize ['modifyvm', :id, '--memory', '2048']
end
server.vm.provision :shell, :path => 'bootstrap.sh', :args => "'#{server_name}' '#{server_ip}'"

end end

The problem is, that after the initial vagrant up szid-ciserver-1 a vagrant reload szid-ciserver-1 or vagrant halt szid-ciserver-1 followed by vagrant up szid-ciserver-1 does not re-run provisioning. This also happens with chef-solo provisioning. If i remove the file .vagrant/machines/szid-ciserver-1/virtualbox/action_provision\ then provisioning will run once again. Is this intended behaviour? It was different with Vagrant <= 1.2.2

— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2279 .

neovatar commented 11 years ago

Ok just read in the changelogs, that this intended. Before this change a dev could just reload his VM to reprovision it with an updated cookbook (e.g. automatically pulled via berkshelf), now he needs to add stuff to the command line :-1: