Vagrant - mlafeldt/chef-runner GitHub Wiki

Here's how to use chef-runner with Vagrant machines that are defined in a local Vagrantfile inside the current working directory:

First, make sure that the Vagrant machine you want to provision is running in the background. You can check the status with vagrant status. If the machine isn't up yet, run vagrant up.

If your Vagrantfile only defines a single machine, simply run chef-runner and it should work. In a multi-machine environment, use the -M option (or --machine) to specify what Vagrant machine you want to provision. The machine name is the name you have defined in your Vagrantfile. To get a list of all machine names, run vagrant status.

Example:

$ chef-runner -M db

chef-runner can also provision "global" Vagrant machines that live in a different directory. For this, all you need to know is the machine's UUID. You can get a list of all UUIDs by running vagrant global-status, e.g.

$ vagrant global-status
id       name    provider   state    directory
-----------------------------------------------------
a748337  default virtualbox running  /path/to/project
...

Then simply pass the UUID of the machine you want to use to chef-runner:

$ chef-runner -M a748337 ...