On Tue, Aug 11, 2015 at 4:00 AM, Francis Chan <[email protected]> wrote:
>     (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

Hello,

as |i| is defined outside of |registry| you can try to use a global
virtualbox value


Something like this:


  (1..3).each do |i|

     config.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


      config.vm.define "registry#{i}" do |registry|
          registry.vm.provision "shell", inline: "echo hello"
       end
    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/CAHqq0eyduMsiV_AzPGf94fT4rnJMXgb0Z9oVXKqs2cTM2fv0ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to