I found a solution. I will essentially have a Ruby hash (created from
json, yaml, xml, or other format), that I feed into Vagrant. I toggle a
default value that I set for primary.
Vagrant.configure("2") do |config|¬
··settings['hosts'].each do |hostname, ipaddr|¬
····default = settings['defaults'][hostname] || false¬
····config.vm.define hostname, primary: default do |node|¬
······node.vm.box = "ubuntu/trusty64"¬
······node.vm.hostname = "#{hostname}"¬
······node.vm.network "private_network", ip: ipaddr¬
······node.vm.provider("virtualbox") { |vbox| vbox.name = "#{hostname}_#{
time}" }¬
······if settings['ports'][hostname]¬
········settings['ports'][hostname].each do |forward|¬
··········node.vm.network "forwarded_port", guest: forward['guest'], host:
forward['host']¬
········end¬
······end¬
······# Provision¬
······node.vm.provision "shell", path: "scripts/#{hostname}.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/63b73397-98fd-48ea-b24d-39c8920878e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.