Hello There
Just to same you some time here.
Vagrant have 2 execution order.
One is top to bottom and other is outside to inside
But the vagrantfile will get evaluated and then executed, so even if
you put blocks before/after they will follow this rule.
output:
==> serverc: serverc
==> serverc: global before
==> serverc: serverc
==> serverc: global after
==> serverc: serverc
==> serverc: serverc
==> serverc: local inside1
==> serverc: serverc
==> serverc: local inside2
Vagrantfile
#global before
config.vm.provision "shell", inline: "hostname; echo 'global before'"
["servera","serverb","serverc"].to_enum.with_index(1).each do |vm_name, i|
config.vm.define vm_name do |server|
server.vm.hostname = vm_name
server.vm.provision "shell", inline: "hostname"
#local
server.vm.provision "shell", inline: "hostname; echo 'local inside1'"
server.vm.provision "shell", inline: "hostname; echo 'local inside2'"
end
end
#global after
config.vm.provision "shell", inline: "hostname; echo 'global after'"
end
So as you can see a global after gets executed before those locals.
So that can be used on global before to setup all the boxes
local inside to do specific task if required
Without getting to complex, what you can do is make your server reach
the other one as part of the provisining
Open to ideas of ppl in the news if they can share some trickery :D
Alvaro.
On Fri, Nov 13, 2015 at 11:14 AM, Joaquin Menchaca <[email protected]> wrote:
> What I did now is use the order of the servers to keep it servers, so A,
> then B, then C. A problem can still arise if C needs something from A, but
> then A needs something form C after it gets it from A... :)
>
> Right now I don't have such a complex orchestration scenario, so I just swap
> the orders. I am doing an experiment with Chef Server, Workstation (knife),
> and 1+ nodes to configure, all on a private Virtualbox network, and using
> ssh tunneling to access the GUI on the Chef Server. It is working pretty
> well.
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/15f75759-9fc7-4509-8ccf-435044d4c3ca%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/CAHqq0ewBw-M%3DL%3DugYiYxb%2B3xQp6414zmYte4806T8vr43LQUHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.