Knife-solo is a gem plugin for Chef's knife utility. It currently adds 3 subcommands to knife: kitchen, prepare and cook
The kitchen command is used to create a new directory structure that fits with chef's standard structure and can be used to build and store recipes.
The prepare command installs Ruby, RubyGems and Chef on a given host. It's structured to auto-detect the target OS and change the installation process accordingly.
The cook command uploads the current kitchen (chef repo) to the target host and runs chef-solo on that host.
Installation is a normal gem installation.
gem install knife-solo
The kitchen command simply takes a name of the directory to store the kitchen structure.
knife kitchen mychefrepo
Currently the directory structure looks like this, but could change as development continues.
mykitchen/ ├── cookbooks ├── data_bags ├── nodes ├── roles ├── site-cookbooks └── solo.rb
The prepare command takes an ssh-style host argument as follows:
knife prepare email@example.com
It will look up SSH information from ~/.ssh/config or in the file specified by -F. You can also pass port information (-p), identity information (-i), or a password (-P). It will use sudo to run some of these commands and will prompt you for the password if it's not supplied on the command line.
The cook command also takes an ssh-style host argument:
knife cook firstname.lastname@example.org
The cook command uploads the current kitchen to the server and runs chef-solo on that server. If you only specify one argument it will look for a node config in +nodes/<hostname>.json+. Or if you want to specify a node config you can pass the path to the file as the second argument.
This uploads all of your cookbooks in addition to a patch that allows you to use data_bags in a read-only fashion from the data_bags folder.
I recommend using Bundler for development. It's also useful to specify binstubs. The .gitignore file contains an entry for the b directory intended for binstubs. This way you can run ./b/knife to do full integration testing on knife-solo commands.
To run tests, run rake after running bundle.
If you're interested in contributing, contact me via github or have a look at the github issues page.