Skip to content

Instantly share code, notes, and snippets.

@rjocoleman
Last active December 30, 2015 16:19
Show Gist options
  • Save rjocoleman/7853529 to your computer and use it in GitHub Desktop.
Save rjocoleman/7853529 to your computer and use it in GitHub Desktop.
Using knife-solo with Chef 11.8.2 on Windows. Making use of Opscode's embedded MinGW (aka RubyInstaller DevKit).

Current as of Chef 11.8.2
Opscode bundle RubyInstaller DevKit with Chef as their embedded environment. RubyInstaller DevKit is a basically a packaging of MinGW/MSYS. It's intended for Chef internal use only and does not include everything we need (but it's close).

Knife-Solo dependencies:

  • Chef
  • A SSH server (communication)
  • rsync (to transfer cookbooks etc)

Please note this is highly dependent on what Opscode bundle with Chef. These won't be supported by Opscode and could completely break your chef-client installation. Updates to Chef will likely remove rsync and it will need to be reinstalled. Opscode might stop using DevKit entirely without warning and break this whole technique.

You have been warned!

How to:

  1. Install a SSHd. I use http://www.bitvise.com/winsshd because its install/configuration can be fully automated and I don't want cygwin or MingGW proper installed.

  2. Optional: In your sshd change the default terminal shell when connected to be C:\opscode\chef\embedded\bin\sh.exe (or whatever chef's path is) (you can use another shell that's provided like bash if you like).

  3. Install MSYS rsync and it's dependency libpopt. These are available, pre-compiled, from the http://sourceforge.net/projects/mingw/files/MSYS/
    Specifically rsync-3.0.8-1-msys-1.0.17-bin.tar.lzma and libpopt-1.15-2-msys-1.0.13-dll-0.tar.lzma are compatible.
    http://sourceforge.net/projects/mingw/files/MSYS/Extension/rsync/rsync-3.0.8-1/rsync-3.0.8-1-msys-1.0.17-bin.tar.lzma/download
    http://sourceforge.net/projects/mingw/files/MSYS/Extension/popt/popt-1.15-2/libpopt-1.15-2-msys-1.0.13-dll-0.tar.lzma/download
    Download and extract them to to C:\opscode\chef\embedded\bin

  4. Add C:\opscode\chef\embedded\bin and C:\opscode\chef\bin to your PATH.
    e.g. setx PATH "%PATH%;C:\opscode\chef\embedded\bin;C:\opscode\chef\bin" /m

  5. You should be able to knife solo cook as you please.

Current issues and workarounds

  • The version check i.e. sudo chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}' returns an invalid result. To avoid you can specify the command line argument --no-chef-check
  • provisioning_path '~/chef-solo/ does not work for me. This is treated as being relative to the home directory so to workaround specify --provisioning-path='chef-solo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment