Skip to content
This repository was archived by the owner on May 18, 2021. It is now read-only.

Commit e651314

Browse files
committed
Update SSH documentation
1 parent c4ed4f6 commit e651314

File tree

1 file changed

+18
-31
lines changed

1 file changed

+18
-31
lines changed

README.md

+18-31
Original file line numberDiff line numberDiff line change
@@ -114,47 +114,34 @@ Last but not least, you can configure both output format and log level of Chef:
114114

115115
### Setting up SSH
116116

117-
By default, chef-runner talks to Vagrant machines using `vagrant ssh`. In a
118-
multi-machine environment, you can use the `-M` option (or `--machine`) to set
119-
the name of the machine you want to provision, for example:
117+
chef-runner uses `ssh` to execute commands on Vagrant machines. If your
118+
`Vagrantfile` only defines a single machine, you don't need to worry about SSH
119+
at all -- simply run `chef-runner` and it should work.
120120

121-
$ chef-runner -M db postgresql::server
121+
In a multi-machine environment, you need to specify what Vagrant machine you
122+
want to use. There are two ways to do this.
122123

123-
However, `vagrant ssh` is relatively slow compared to plain `ssh`. In order to
124-
make use of the latter, you have to do two things.
124+
1) Use the `-M` option (or `--machine`) to set the name of the Vagrant machine.
125+
The machine name is the name you have defined in your `Vagrantfile`. To get a
126+
list of all machine names, run `vagrant status`.
125127

126-
First, assign your VM a private static IP address in the `Vagrantfile`:
128+
Example:
127129

128-
```ruby
129-
Vagrant.configure("2") do |config|
130-
config.vm.network "private_network", :ip => "10.11.12.13"
131-
# ...
132-
end
133-
```
134-
135-
Second, add the following settings to your `~/.ssh/config` file (you have to
136-
adapt `Host` and `HostName`):
130+
$ chef-runner -M db
137131

138-
```
139-
Host example.local
140-
HostName 10.11.12.13
141-
User vagrant
142-
UserKnownHostsFile /dev/null
143-
StrictHostKeyChecking no
144-
PasswordAuthentication no
145-
IdentityFile ~/.vagrant.d/insecure_private_key
146-
IdentitiesOnly yes
147-
```
132+
2) Use the `-H` option (or `--host`) to set a hostname that was configured for
133+
direct SSH access to the Vagrant machine. This requires that your machine has a
134+
static IP address and that your `~/.ssh/config` file has a configuration section
135+
for that hostname (`vagrant ssh-config` can help you here). While this option
136+
needs more setup work, SSH access is a bit faster compared to `-M`.
148137

149-
Afterwards, you will be able to log into the VM via `ssh example.local` and,
150-
more importantly, you can now pass the hostname to chef-runner via `-H` or
151-
`--host`, for example:
138+
Example:
152139

153140
$ chef-runner -H example.local
154141

155142
*Technical note: A future version of chef-runner might use `vagrant ssh-config`
156143
to get the SSH settings of a Vagrant machine and then cache them somewhere, see
157-
[GitHub issue #3].*
144+
[GitHub pull request].*
158145

159146
### Use with Vim
160147

@@ -227,7 +214,7 @@ We welcome contributed improvements and bug fixes via the usual workflow:
227214

228215

229216
[Berkshelf]: http://berkshelf.com/
230-
[GitHub issue #3]: https://github.com/mlafeldt/chef-runner/issues/3
217+
[GitHub pull request]: https://github.com/mlafeldt/chef-runner/pull/3
231218
[Practicing Ruby cookbook]: https://github.com/elm-city-craftworks/practicing-ruby-cookbook#readme
232219
[Vagrant]: http://vagrantup.com/
233220
[VirtualBox]: https://www.virtualbox.org/

0 commit comments

Comments
 (0)