website/docs: clearer provisioner ordering on multi-machine [GH-3833]

This commit is contained in:
Mitchell Hashimoto 2014-05-20 20:21:44 -07:00
parent 2771bf8675
commit 328afac457
1 changed files with 19 additions and 0 deletions

View File

@ -62,6 +62,25 @@ just like other Vagrantfiles within the
If you're familiar with programming, this is similar to how languages have If you're familiar with programming, this is similar to how languages have
different variable scopes. different variable scopes.
When using these scopes, order of execution for things such as
provisioners becomes important. Vagrant enforces ordering outside-in, in
the order listed in the Vagrnatfile. For example, with the Vagrantfile
below:
```ruby
Vagrant.configure("2") do |config|
config.vm.provision :shell, :inline => 'echo A'
config.vm.define :testing do |test|
test.vm.provision :shell, :inline => 'echo B'
end
config.vm.provision :shell, :inline => 'echo C'
end
```
The provisioners in this case will output "A", then "C", then "B". Notice
that "B" is last. That is because the ordering is outside-in, in
the order of the file.
## Controlling Multiple Machines ## Controlling Multiple Machines
The moment more than one machine is defined within a Vagrantfile, the The moment more than one machine is defined within a Vagrantfile, the