I'm constructing 1..N nodes for a Mesos test bed but I need to mount a
secondary drive for the Docker to each node because CentOS is by default
using the loopback device.
When I loop each node I have attach the drive so I can run Puppet to
configure it for Docker prior to starting the Docker service. The problem
is that the *vm.provider* section seems to always have to be at the end of
the *vm.define*. Anywhere else results in a "block (2 levels) in <top
(required)>...", in this example, it says "registry" is undefined.
Vagrant = 1.74
VBox = 5.0.1r (using this cause I had to upgrade to Win10)
Ignore the size of the drive, right now just trying to figure this part out.
I'm just running "vagrant status" to let it parse the file.
*This works:*
(1..3).each do |i|
config.vm.define "registry#{i}" do |registry|
registry.vm.provision "shell", inline: "echo hello"
registry.vm.provider :virtualbox do |vb_config|
second_disk = File.join(ENV["VAGRANT_HOME"], "/registrydisk
#{i}2.vdi" ).gsub(%r{\\}) { "/" }
puts second_disk
unless File.exist?(second_disk)
vb_config.customize ['createhd', '--filename',
second_disk, '--size', 100 * 1024]
end
vb_config.customize ['storageattach', :id,
'--storagectl', 'IDE Controller', '--port', 1, '--device', 0, '--type',
'hdd', '--medium', second_disk]
end
end
end
end
*This does not:*
(1..3).each do |i|
config.vm.define "registry#{i}" do |registry|
registry.vm.provision "shell", inline: "echo hello"
registry.vm.provider :virtualbox do |vb_config|
second_disk = File.join(ENV["VAGRANT_HOME"], "/registrydisk
#{i}2.vdi" ).gsub(%r{\\}) { "/" }
puts second_disk
unless File.exist?(second_disk)
vb_config.customize ['createhd', '--filename',
second_disk, '--size', 100 * 1024]
end
vb_config.customize ['storageattach', :id,
'--storagectl', 'IDE Controller', '--port', 1, '--device', 0, '--type',
'hdd', '--medium', second_disk]
end
end
registry.vm.provision "shell", inline: "echo hello again"
end
end
--
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/f10f7452-9af3-4dc3-bd8c-578793bdd42a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.