configuration errors, forwarded_port

231 views
Skip to first unread message

richard kappler

unread,
Jun 5, 2015, 12:23:48 PM6/5/15
to vagra...@googlegroups.com
Running Vagrant 1.72 in Ubuntu 14.04 following the tutorials in Ansible: Up and Running book. I've had one vagrant machine running, no problem, now trying to run multiple vagrant machines. My Vagrantfile:

####################################################
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  #Use the same key for each machine
  config.ssh.insert_key=false

 config.vm.define "vagrant1" do |vagrant1|
  vagrant1.vm.box = "ubuntu/trusty64"
  vagrant1.vm.network "forwarded_port", guest: 80, host: 8080
  vagrant1.vm.network "forwarded_port", guest: 443, host: 8443
 end
 config.vm.define "vagrant2" do |vagrant2|
  vagrant2.vm.box = "ubuntu/trusty64"
  vagrant2.vm.network "forwarded_port", guest: 80, host: 8081
  vagrant2.vm.network "forwarded_port", guest: 443, guest: 8444
 end
 config.vm.define "vagrant3" do |vagrant3|
  vagrant3.vm.box = "ubuntu/trusty64"
  vagrant3.vm.network "forwarded_port", guest: 80, host: 8082
  vagrant3.vm.network "forwarded_port", guest: 443, host: 8445
 end
end
#####################################################

and my console output:

#####################################################
vagrant up
Bringing machine 'vagrant1' up with 'virtualbox' provider...
Bringing machine 'vagrant2' up with 'virtualbox' provider...
Bringing machine 'vagrant3' up with 'virtualbox' provider...
==> vagrant1: Checking if box 'ubuntu/trusty64' is up to date...
==> vagrant1: Clearing any previously set forwarded ports...
==> vagrant1: Clearing any previously set network interfaces...
==> vagrant1: Preparing network interfaces based on configuration...
    vagrant1: Adapter 1: nat
==> vagrant1: Forwarding ports...
    vagrant1: 80 => 8080 (adapter 1)
    vagrant1: 443 => 8443 (adapter 1)
    vagrant1: 22 => 2222 (adapter 1)
==> vagrant1: Booting VM...
==> vagrant1: Waiting for machine to boot. This may take a few minutes...
    vagrant1: SSH address: 127.0.0.1:2222
    vagrant1: SSH username: vagrant
    vagrant1: SSH auth method: private key
    vagrant1: Warning: Remote connection disconnect. Retrying...
==> vagrant1: Machine booted and ready!
==> vagrant1: Checking for guest additions in VM...
==> vagrant1: Mounting shared folders...
    vagrant1: /vagrant => /home/richard/playbooks
==> vagrant1: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> vagrant1: to force provisioning. Provisioners marked to run always will still run.
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* Forwarded port definitions require a "host" and "guest" value
* Ports to forward must be 1 to 65535
#######################################################

What ridiculously obvious thing am I missing?

regards, Richard

Alvaro Miranda Aguilera

unread,
Jun 5, 2015, 7:30:33 PM6/5/15
to vagra...@googlegroups.com
On Sat, Jun 6, 2015 at 4:23 AM, richard kappler <richk...@gmail.com> wrote:
> VAGRANTFILE_API_VERSION = "2"
>
> Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
> #Use the same key for each machine
> config.ssh.insert_key=false
>
> config.vm.define "vagrant1" do |vagrant1|
> vagrant1.vm.box = "ubuntu/trusty64"
> vagrant1.vm.network "forwarded_port", guest: 80, host: 8080
> vagrant1.vm.network "forwarded_port", guest: 443, host: 8443
> end
> config.vm.define "vagrant2" do |vagrant2|
> vagrant2.vm.box = "ubuntu/trusty64"
> vagrant2.vm.network "forwarded_port", guest: 80, host: 8081
> vagrant2.vm.network "forwarded_port", guest: 443, guest: 8444
> end
> config.vm.define "vagrant3" do |vagrant3|
> vagrant3.vm.box = "ubuntu/trusty64"
> vagrant3.vm.network "forwarded_port", guest: 80, host: 8082
> vagrant3.vm.network "forwarded_port", guest: 443, host: 8445
> end
> end

he

small error

vagrant2.vm.network "forwarded_port", guest: 443, guest: 8444

guest guest

Alvaro.

richard kappler

unread,
Jun 5, 2015, 7:57:36 PM6/5/15
to vagra...@googlegroups.com

OMG! How did I miss that? Thanks Alvaro!

--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/ZXgAzzWpm_c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alvaro Miranda Aguilera

unread,
Jun 5, 2015, 8:28:45 PM6/5/15
to vagra...@googlegroups.com
Ah, no big deal, keep going.

as all the boxes use the same box, you can move that part out.


Then later you can do something like this:

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#Use the same key for each machine
config.ssh.insert_key=false
config.vm.box = "ubuntu/trusty64"
["first","second","third"].to_enum.with_index(1).each do |vm_name, i|
port1 = 8080+i-1
port2 = 8443+i-1
config.vm.define vm_name = vm_name do |config|
config.vm.network "forwarded_port", guest: 80, host: port1
config.vm.network "forwarded_port", guest: 443, host: port2
end
end
end


And allow you put whatever name you like to the box..

Have fun
Alvaro.
> 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
Reply all
Reply to author
Forward
0 new messages