I have a multi-machine roaming setup with some blocks that I need to change for the execution order.
Due to the fact that the firewall is external, the latter is executed in the nested block itself.
I need a way to make selection locks more nested so that they are executed last. I tried adding mach.vm.define, but these blocks are not executing, and I don't understand why.
Normal execution, wrong order
Vagrant.require_version ">= 1.6.0" VAGRANTFILE_API_VERSION = "2" require 'yaml' machines = YAML.load_file('vagrant.yaml') Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| machines.each do |machine| config.vm.define machine["name"] do |mach| machine['run_this'].each do |run_this| mach.vm.provider "virtualbox" do |v, override|
Ideal solution, but an additional nested block does not execute
Vagrant.require_version ">= 1.6.0" VAGRANTFILE_API_VERSION = "2" require 'yaml' machines = YAML.load_file('vagrant.yaml') Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| machines.each do |machine| config.vm.define machine["name"] do |mach| machine['run_this'].each do |run_this| mach.vm.provider "virtualbox" do |v, override|
Is there a way to make the training level one level deeper so that it works after the contents of the vendor block?
EDIT: anything that is specific to the provider is unacceptable (like another provider block) or anything that causes duplicate code.
source share