Hello, Vagrant bxes are created top to bottom,
So the first VM created can be used to copy/create files to the other boxes. You could create files with an script, or have a file in the current directory and that will be available in /vagrant/ directory so you could use that to distribute a file. Thanks Alvaro. On Sun, Apr 24, 2016 at 7:53 PM, Joaquin Menchaca <[email protected]> wrote: > The docs <https://www.vagrantup.com/docs/multi-machine/> say, for making > one machine a primary, you can do: > > config.vm.define "web", primary: true do |web| > # ...end > > > How do you do it, if you bring these up dynamically, such as a hosts file? > > nodes = Hash.new > File.readlines('config/global.hosts').map(&:chomp).each do |line| > ipaddr, nodename = line.split(" ") > nodes[nodename] = ipaddr > end > > Vagrant.configure("2") do |config| > nodes.each do |nodename, ipaddr| > config.vm.define nodename do |node| > node.vm.box = "ubuntu/trusty64" > node.vm.hostname = "#{nodename}" > node.vm.network "private_network", ip: ipaddr > node.vm.provider("virtualbox") { |vbox| vbox.name = "#{nodename}" } > node.vm.provision "shell", path: "scripts/#{nodename}.sh" > 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/cc5db890-e913-42e8-bbaf-fa5ff32f3de6%40googlegroups.com > <https://groups.google.com/d/msgid/vagrant-up/cc5db890-e913-42e8-bbaf-fa5ff32f3de6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/CAHqq0ewG5c0T%2B0MdrOKBDn-%3D-6jyE3sS3bygK9RwNwp8%3DDEYZQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
