rhys.james.campbell via Vagrant
2018-11-22 15:31:03 UTC
Hello All,
I am trying to forward a port to a couple of servers in a Vagrant file but
the variable is not being incremented for some reason...
All I'm doing is this...
if host.start_with?("testnagios")
config.vm.network "forwarded_port", guest: 80, host:
nagios_forward_port
nagios_forward_port += 1
The first instance works but I get the following error when the second
instance fires up...
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 8888 is already in use
on the host machine.
To fix this, modify your current project's Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:
config.vm.network :forwarded_port, guest: 80, host: 1234
Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding. You could
try 'vagrant reload' (equivalent of running a halt followed by an up)
so vagrant can attempt to auto-correct this upon booting. Be warned
that any unsaved work might be lost.
I set the nagios_forward_port right after the Vagrant.configure("2") do
|config| line. It is not referenced anywhere else in the Vagrantfile other
than the lines given above. Is there something about scope I'm missing here?
Cheers,
Rhys
--
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 vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/deadadb0-ef6e-4d8f-8683-e5a63b9cd98c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I am trying to forward a port to a couple of servers in a Vagrant file but
the variable is not being incremented for some reason...
All I'm doing is this...
if host.start_with?("testnagios")
config.vm.network "forwarded_port", guest: 80, host:
nagios_forward_port
nagios_forward_port += 1
The first instance works but I get the following error when the second
instance fires up...
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 8888 is already in use
on the host machine.
To fix this, modify your current project's Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:
config.vm.network :forwarded_port, guest: 80, host: 1234
Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding. You could
try 'vagrant reload' (equivalent of running a halt followed by an up)
so vagrant can attempt to auto-correct this upon booting. Be warned
that any unsaved work might be lost.
I set the nagios_forward_port right after the Vagrant.configure("2") do
|config| line. It is not referenced anywhere else in the Vagrantfile other
than the lines given above. Is there something about scope I'm missing here?
Cheers,
Rhys
--
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 vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/deadadb0-ef6e-4d8f-8683-e5a63b9cd98c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.