tknerr / vagrant-managed-servers

Enables Vagrant to ssh into and provision managed servers
MIT License
185 stars 30 forks source link

Port on Remote Server #23

Closed pascalwacker closed 10 years ago

pascalwacker commented 10 years ago

Hi Well I guess this isn't an issue, probably, but I didn't know where to put it elsewhere. Im using port 2222 on my remote server for SSH is it possible to set a custom port with this plugin? When I'm on it anyway another question. I created my VM with https://puphpet.com/ which creats a pretty big Vagrantfile. Is there a tutorial or something that helps seting it up to work with the managed server plugin? Cheers Wawa

kikitux commented 10 years ago

my undestanding would be you can set:

config.ssh.host - The hostname or IP to SSH into. By default this is empty,

because the provider usually figures this out for you.

config.ssh.port - The port to SSH into. By default this is port 22.

On Fri, Oct 3, 2014 at 10:37 AM, Pascal Wacker notifications@github.com wrote:

Hi Well I guess this isn't an issue, probably, but I didn't know where to put it elsewhere. Im using port 2222 on my remote server for SSH is it possible to set a custom port with this plugin? When I'm on it anyway another question. I created my VM with https://puphpet.com/ which creats a pretty big Vagrantfile. Is there a tutorial or something that helps seting it up to work with the managed server plugin? Cheers Wawa

— Reply to this email directly or view it on GitHub https://github.com/tknerr/vagrant-managed-servers/issues/23.

pascalwacker commented 10 years ago

@kikitux I actually tried the config.ssh.port before I wrote here, but unfortunately it produced this error: ManagedServers Provider:

tknerr commented 10 years ago

@pascalwacker did you use override.ssh.port inside the provider block? This should work I guess.

If it does not, can you share your Vagrantfile?

pascalwacker commented 10 years ago

@tknerr hmm seams like I've put the port setting somewhere strange in my config. So the port problem is resolved, but still I'm not sure if I'm connected correctly. I'm trying to have it setup like this: vagrant up dev should bring up the local Vagrant, while vagrant up prod --provider=managed should connect to my remote server (and in the end run some puppet files there to install some stuff)

When I try to connect to my remote server I get this:

C:\VirtualMachines\VagrantBoxes\APP01>vagrant up prod --provider=managed
Bringing machine 'prod' up with 'managed' provider...
==> prod: Warning! The ManagedServers provider doesn't support any of the Vagrant
==> prod: high-level network configurations (`config.vm.network`). They
==> prod: will be silently ignored.
==> prod: Linking vagrant with managed server xxx.xxx.xxx.xxx
==> prod:  -- Server: xxx.xxx.xxx.xxx

As I understand it, The linking to the remote server is done, successfully, but what makes me nervous is the config.vm.network message. As I understood it, this is only for the dev environement and shouldn't affect the prod config at all. So why do I see that message then? If I run the command vagrant ssh prod, I get a ssh connection to my remote server so it seams to work, but still there's that error.

This is my Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# current dir
dir = File.dirname(File.expand_path(__FILE__))

Vagrant.configure("2") do |config|
    #
    # local machine
    #
    # vagrant up dev
    # vagrant ssh dev
    #
    config.vm.define "dev", primary: true do |dev_config|
        dev_config.vm.box = "puphpet/ubuntu1404-x64"
        dev_config.vm.network :private_network, ip: "192.168.300.51"
    end
    #
    # remote machine
    #
    # vagrant up prod --provider=managed
    # vagrant ssh prod
    #
    config.vm.define "prod", autostart:false do |prod_config|
        prod_config.vm.box = "tknerr/managed-server-dummy"
        prod_config.vm.provider :managed do |managed_config, override|
            managed_config.server = "91.250.84.127"
            override.ssh.username = "pascal.wacker"
            override.ssh.private_key_path = "#{dir}/puphpet/files/dot/ssh/id_rsa"
            override.ssh.port = "2222"
        end
    end
end
kikitux commented 10 years ago

I take it as informative.

the blocks are correct for multi machine

you can test creating other Vagrantfile, removing the dev block, and I expect you will get the same message.

looks good to me.

alvaro

On 4/10/2014, at 10:21 pm, Pascal Wacker notifications@github.com wrote:

Hmm seams like I've put the port setting somewhere strange in my config. So the port problem is resolved, but still I'm not sure if I'm connected correctly. I'm trying to have it setup like this: vagrant up dev should bring up the local Vagrant, while vagrant up prod --provider=managed should connect to my remote server (and in the end run some puppet files there to install some stuff)

When I try to connect to my remote server I get this:

C:\VirtualMachines\VagrantBoxes\APP01>vagrant up prod --provider=managed Bringing machine 'prod' up with 'managed' provider... ==> prod: Warning! The ManagedServers provider doesn't support any of the Vagrant ==> prod: high-level network configurations (config.vm.network). They ==> prod: will be silently ignored. ==> prod: Linking vagrant with managed server xxx.xxx.xxx.xxx ==> prod: -- Server: xxx.xxx.xxx.xxx As I understand it, The linking to the remote server is done, successfully, but what makes me nervous is the config.vm.network message. As I understood it, this is only for the dev environement and shouldn't affect the prod config at all. So why do I see that message then? If I run the command vagrant ssh prod, I get a ssh connection to my remote server so it seams to work, but still there's that error.

This is my Vagrantfile

-- mode: ruby --

vi: set ft=ruby :

current dir

dir = File.dirname(File.expand_path(FILE))

Vagrant.configure("2") do |config| #

local machine

#
# vagrant up dev
# vagrant ssh dev
#
config.vm.define "dev", primary: true do |dev_config|
    dev_config.vm.box = "puphpet/ubuntu1404-x64"
    dev_config.vm.network :private_network, ip: "192.168.300.51"
end
#
# remote machine
#
# vagrant up prod --provider=managed
# vagrant ssh prod
#
config.vm.define "prod", autostart:false do |prod_config|
    prod_config.vm.box = "tknerr/managed-server-dummy"
    prod_config.vm.provider :managed do |managed_config, override|
        managed_config.server = "91.250.84.127"
        override.ssh.username = "pascal.wacker"
        override.ssh.private_key_path = "#{dir}/puphpet/files/dot/ssh/id_rsa"
        override.ssh.port = "2222"
    end
end

end — Reply to this email directly or view it on GitHub.

pascalwacker commented 10 years ago

@kikitux I just removed the lines for the dev vm. You where right same error again. So I guess, I can just ignore it for now, cause it seams to work fine. (:

kikitux commented 10 years ago

well, the text is informatie, is telling you that in case there is a config.vm.network it will be ignored.

On 4/10/2014, at 10:34 pm, Pascal Wacker notifications@github.com wrote:

@kikitux I just removed the lines for the dev vm. You where right same error again. So I guess, I can just ignore it for now, cause it seams to work fine. (:

— Reply to this email directly or view it on GitHub.

tknerr commented 10 years ago

@pascalwacker yes the network warning is just informative, though I agree that it should not appear when you don't have any network settings (need to fix that)

@kikitux thanks for jumping in an responding so fast! :+1: Am 04.10.2014 12:01 schrieb "Pascal Wacker" notifications@github.com:

Closed #23 https://github.com/tknerr/vagrant-managed-servers/issues/23.

— Reply to this email directly or view it on GitHub https://github.com/tknerr/vagrant-managed-servers/issues/23#event-174130573 .