Hi,
I am trying to write a Vagrantfile that spins up 'N' VMs with static IPs
defined my me which are defined by an environment variable(array)
export ARR_IP=("10.20.20.10" "10.20.20.11" "10.20.20.12")
Vagrantfile:
CFG_NUM = 3
CFG_IP = "${ARR_IP[*]}"
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.forward_agent = true
(1..CFG_NUM).each do |i|
config.vm.define CFG_NAME+"#{i}" do |s|
s.vm.box = "ceph/ubuntu-xenial"
s.vm.hostname = CFG_NAME+"#{i}"
s.vm.network :private_network, ip: CFG_IP["#{i-1}"] ====> trying
to iterate over IPs
s.vm.provider :libvirt do |v|
v.memory = 4094
v.cpus = 2
v.nested = true
end
end
end
end
This is throwing an error for me which says IP is nil
Error occurred while creating new network: {:iface_type=>:private_network,
:netmask=>"255.255.255.0", :dhcp_enabled=>true, :forward_mode=>"nat",
:ip=>nil, :protocol=>"tcp", :id=>"5d813bfc-2d27-49cf-8351-9948e73f9b66"}.
What is the correct way to substitute the array element here?
Regards
--
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/172173a6-1091-4127-bcb8-6b9c27baed7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.