@@ -114,47 +114,34 @@ Last but not least, you can configure both output format and log level of Chef:
114
114
115
115
### Setting up SSH
116
116
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.
120
120
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.
122
123
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 ` .
125
127
126
- First, assign your VM a private static IP address in the ` Vagrantfile ` :
128
+ Example :
127
129
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
137
131
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 ` .
148
137
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:
152
139
153
140
$ chef-runner -H example.local
154
141
155
142
* Technical note: A future version of chef-runner might use ` vagrant ssh-config `
156
143
to get the SSH settings of a Vagrant machine and then cache them somewhere, see
157
- [ GitHub issue # 3 ] .*
144
+ [ GitHub pull request ] .*
158
145
159
146
### Use with Vim
160
147
@@ -227,7 +214,7 @@ We welcome contributed improvements and bug fixes via the usual workflow:
227
214
228
215
229
216
[ 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
231
218
[ Practicing Ruby cookbook ] : https://github.com/elm-city-craftworks/practicing-ruby-cookbook#readme
232
219
[ Vagrant ] : http://vagrantup.com/
233
220
[ VirtualBox ] : https://www.virtualbox.org/
0 commit comments