Not sure if this is a bug or poor understanding of ssh-config intent, so please close if necessary.
"vagrant ssh-config" takes a --host argument, which I assume is meant to return the SSH configuration for just that host. (This is also assumed by ServerSpec, which parses the output of "vagrant ssh-config --host [x]" to get SSH details for multi-host vagrant instances.) However, instead of returning the SSH config for just host [x], it returns the SSH config for all hosts, each with a "Host [x]" directive. I've confirmed this with version 1.6.5 of Vagrant.
Example: I have a Vagrantfile that looks like this:
Vagrant.configure("2") do |config|
config.vm.define "coney" do |coney|
coney.vm.box = "precise32"
coney.vm.hostname = "coney.rabbit"
coney.vm.box_url = "http://files.vagrantup.com/precise32.box"
coney.vm.network "private_network", ip: "192.168.50.10"
end
config.vm.define "rabbit" do |rabbit|
rabbit.vm.box = "precise32"
rabbit.vm.hostname = "rabbit.rabbit"
rabbit.vm.box_url = "http://files.vagrantup.com/precise32.box"
rabbit.vm.network "private_network", ip: "192.168.50.11"
end
end
end
Here's what vagrant ssh-config returns:
$ vagrant ssh-config
Host coney
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/hugh/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Host rabbit
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/hugh/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Given that, I'd expect the output of vagrant ssh-config --host coney to return just that machine's config. Instead, I see this:
$ vagrant ssh-config --host coney
Host coney
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/hugh/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Host coney
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/hugh/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
That seems incorrect to me; I would argue that either "--host" should print one-and-only-one config, or the "--host" argument should be dropped entirely (and folks can parse the output on their own if they only need one host).
Thanks, and please let me know if you need any further information.
Not sure if this is a bug or poor understanding of ssh-config intent, so please close if necessary.
"vagrant ssh-config" takes a --host argument, which I assume is meant to return the SSH configuration for just that host. (This is also assumed by ServerSpec, which parses the output of "vagrant ssh-config --host [x]" to get SSH details for multi-host vagrant instances.) However, instead of returning the SSH config for just host [x], it returns the SSH config for all hosts, each with a "Host [x]" directive. I've confirmed this with version 1.6.5 of Vagrant.
Example: I have a Vagrantfile that looks like this:
Here's what
vagrant ssh-config
returns:Given that, I'd expect the output of
vagrant ssh-config --host coney
to return just that machine's config. Instead, I see this:That seems incorrect to me; I would argue that either "--host" should print one-and-only-one config, or the "--host" argument should be dropped entirely (and folks can parse the output on their own if they only need one host).
Thanks, and please let me know if you need any further information.