What?! You want to use chef to manage Windows machines? Good luck with that...
I am not saying you cannot use chef under Windows. It is just that Windows lacks a package manager, which makes installing/uninstalling/dependency handling under chef way more difficult than anyone in their right mind would deal with. I know, I know, there are someone trying to rectify that, but until that has gone through a few more iterations we are left with nada. Or are we?
There is an excellent project called Cygwin that let you have quite a complete Unix/Posix environment under Windows. And as it happens it has a decent package manager that has the features we like, with install/uninstall actions, dependency handling and more.
The only problem is that this package manager is a GUI application which makes it unfit for our purpose. As luck will have it, there is an excellent command line package manager called apt-cyg which do fit our purpose.
So, by utilizing
apt-cyg, chef-apt-cyg makes it easy to install packages under Cygwin. Or wouldn't you say so:
package "git" do action :install end
These are the high-level steps to get a Windows machine ready for using chef-apt-cyg:
- Download and install Cygwin (obviously)
- Install additional packages needed by chef
- Install RubyGems
- Install chef with related tools
Instead of doing this manually, most of these are automated. Just follow these steps:
- Create a new directory or use an existing as long as it is empty
NB! cannot be the same directory as Cygwin is installed into
- Download the following files into this directory
- Open cmd.exe in this directory
- Start install-cygwin-chef-and-apt-cyg.cmd
When the script is finished, you will have a new/updated installation of Cygwin under c:\cygwin, or whatever directory you specified.
For more information look at the Installation on Windows walk through on Opscode's wiki. Just remember that you should not install RubyInstaller/RubyInstaller DevKit for Windows as this won't work properly under Cygwin.
Just make sure that this cookbook is selected before you start installing packages. You can add:
to all your recipes that install packages, or you can just make sure it's on the run list somewhere early on. The cookbook itself ensures that apt-cyg is installed and up to date.
License and Author
Author: Stig Kleppe-Jørgensen (firstname.lastname@example.org)
Copyright: 2011-, Stig Kleppe-Jørgensen
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.