Hi Jim, You've proved why I shouldn't code when tired - thank you so much :)
On Monday, 6 May 2019 04:09:54 UTC+1, Jim McGinness wrote: > > Knowing nothing about Ruby syntax, I'd guess that you are missing colons > on the front of the "fwd_https_port" in the initialization of "nodes". > > On Sun, May 5, 2019 at 5:39 PM Neil E <[email protected] <javascript:>> > wrote: > >> Hi everyone, >> >> I was hoping someone can help point out where I'm going wrong here >> please, it's driving me nuts! >> >> I'm trying to define variables (highlighted blue) to use as ports for >> *forwarded_port >> *(highlighted yellow) but something is wrong somewhere - hoping someone >> can help please! :) >> >> If I remove the variables at the top ('nodes') and the two >> forwarded_port lines, 'vagrant up' works fine. >> >> (vagrant up output below code). >> >> Thanks very much in advance!! >> >> Here is my Vagrantfile: >> >> domain = 'largo.lan' >> >> nodes = [ >> { :hostname => 'ans01', :ip => '192.168.56.211', :fwd_http_port => >> '8080', fwd_https_port => '8443', :box => 'generic/ubuntu1804' }, >> { :hostname => 'ans02', :ip => '192.168.56.212', :fwd_http_port => >> '8081', fwd_https_port => '8444', :box => 'generic/ubuntu1804' }, >> { :hostname => 'ans03', :ip => '192.168.56.213', :fwd_http_port => >> '8082', fwd_https_port => '8445', :box => 'generic/ubuntu1804' }, >> ] >> >> Vagrant.configure("2") do |config| >> nodes.each do |node| >> config.vm.define node[:hostname] do |nodeconfig| >> nodeconfig.vm.box = node[:box] >> nodeconfig.vm.provision "shell", path: >> "vagrant_scripts/post_box_build.sh" >> nodeconfig.vm.hostname = node[:hostname] + ".box" >> nodeconfig.vm.network :private_network, ip: node[:ip] >> nodeconfig.vm.network "forwarded_port", guest: 80, host: >> node[:fwd_http_port] >> nodeconfig.vm.network "forwarded_port", guest: 443, host: >> node[:fwd_https_port] >> nodeconfig.vm.boot_timeout = 600 >> memory = node[:ram] ? node[:ram] : 512; >> nodeconfig.vm.provider :virtualbox do |vb| >> vb.linked_clone = true >> vb.customize [ >> "modifyvm", :id, >> "--cpuexecutioncap", "50", >> "--memory", memory.to_s, >> "--vram", "12", >> "--natdnshostresolver1", "on", >> ] >> end >> end >> end >> end >> >> >> >> And when I run it I get this: >> $ vagrant up >> Vagrant failed to initialize at a very early stage: >> >> There was an error loading a Vagrantfile. The file being loaded >> and the error message are shown below. This is usually caused by >> a syntax error. >> >> Path: /home/neil/git/ansible_test/Vagrantfile >> Line number: 10 >> Message: NameError: undefined local variable or method `fwd_https_port' >> for main:Object >> $ >> >> >> Thanks very much in advance!! >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/vagrant-up/839f7fff-a936-45e8-a2b2-295b3e161901%40googlegroups.com >> >> <https://groups.google.com/d/msgid/vagrant-up/839f7fff-a936-45e8-a2b2-295b3e161901%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/dc491509-da47-4aa8-9fda-608bfade95df%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
