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

ENHANCEMENT: Provide orchestration for provisioning on multi-system use case #6435

Closed darkn3rd closed 8 years ago

darkn3rd commented 9 years ago

SUMMARY: I have a need for provisioning to happen only after _all_ systems are up. It would be great to have a parameter than can signal when the provisioning should happen, only after a particular system, or :all for all systems, are up.

Here's an example script.

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

  # workstation node for orchestration of chef
  config.vm.define "work" do |work|
    work.vm.box = "hashicorp/precise64"
    work.vm.hostname = "workstation01"
    work.vm.network "private_network", ip: "192.168.50.4"
    work.vm.provision "shell", path: "setup-work.sh", after: "server"
  end

  # server to configure
  config.vm.define "server" do |server|
    server.vm.box = "hashicorp/precise64"
    server.vm.hostname = "server01"
    server.vm.network "private_network", ip: "192.168.50.5"
    server.vm.provision "shell", path: "setup-server.sh"
  end
end

Here, we tell the provisioner to only apply this after the "server" is up and configured, as it's script requires server to be running first.

WORKAROUND: In the mean time, this is what I can do to workaround this issue:

$ vagrant up --no-provision # bring all systems up first
$ vagrant provision         # then provision

NOTES: Originally, had this as a bug, but discovered the issue on my end (user-loser-error), but this elicited the use-case for some level of orchestration in multi-machine scenarios, so made this an an enhancement request.

sethvargo commented 8 years ago

Hi @darkn3rd

Thank you for opening an issue. Multi-machine orchestration seems a bit out of scope for something that Vagrant should be responsible for. I would recommend you take a look at our newest open source project, Otto, for those orchestration bits :smile:. Thanks!