hello

vagrant expect the ssh to be in the port 22
I think you better using an intermediate tool to do that changes before
vagrant.

if you are using virtualbox, have a look at packer virtualbox-ovf

that can start from an existing vm, however change the port yes may work,
you build them in 2 steps.

step 1, from existing vm with sshd on port 22, change it to 222, poweroff
step 2, existing vm with sshd on port 222 install the app that uses port
22, poweroff create vagrant box with vagrant file that says use port 222


but in all is not a normal use case for vagrant, so i think the best is to
build boxes that are ready to use for vagrant.

you can use packer to build from an iso, so there are options.

for vagrant itself i think is a bit hard

Alvaro.

On Sat, Dec 2, 2017 at 11:03 PM, Marcin Dulak <[email protected]>
wrote:

> 1. I have an official box that uses sshd on port 22, that could be
> https://app.vagrantup.com/centos/ https://app.vagrantup.com/fedora/
> https://app.vagrantup.com/ubuntu, anything
> 2. I start guest using that box with Vagrant and reconfigure sshd on the
> guest to listen on a different port (222). This is for example due to
> starting another service on port 22 on the guest. The new service on port
> 22 does not need to exposed to the Vagrant host.
> 3. I want now Vagrant to know about this change after I reload the same
> box, by passing environment variables to Vagrantfile or some other way
> 4. After creating a set of scripts that configure my box (ansible, puppet,
> docker, ...) this way, I can now use them on a physical host, VM not
> managed by Vagrant, or a VM managed by Vagrant, all having sshd on port 222
>
> I think I'm clear enough, if not try my Vagrantfile.
>
> Best regards,
>
> Marcin
>
> On Saturday, December 2, 2017 at 4:41:37 PM UTC+1, Alvaro Miranda Aguilera
> wrote:
>>
>> Vagrant will create a local port say on 2222 for the first box
>>
>> When tries for the 2nd port, will try 2222 used? Then 2223 or other
>>
>> So still not clear whats the benefit or requirement on doing this.
>>
>> Is this really needed? Why?
>>
>> And what are those boxes you mention?
>>
>> Alvaro
>>
>>
>> --
> 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/23c69ff1-0157-419d-b548-fddabaa2b876%40googlegroups.com
> <https://groups.google.com/d/msgid/vagrant-up/23c69ff1-0157-419d-b548-fddabaa2b876%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Alvaro

-- 
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/CAHqq0exkaJcpJJ2hfw6rBVeM5GBzm%2BruszBXPKENaE3DXBYE3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to