While Ansible is not supported on Windows, it is very easy to get it up and running. The Ansible documentation provides information on how to do it using Windows Subsystem for Linux (Beta), I’ve run into issues trying to get WSL up and running so instead opted for Cygwin.
For those who are unfamiliar with Cygwin, it is “a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.”
Step by Step Guide
Note: This guide was written using Cygwin 2.877, but should be applicable for all versions.
- Download Cygwin.
- Run the Cygwin installation file.
- When asked which download source you’d like to use, select “Install from Internet”.
- Select a root directory where you’d like to install the application. I leave it as the default, C:\cygwin64
- Select a directory where you’d like to install your Cygwin packages.
- Select the method which suits your internet connection type. e.g If you’re not connecting from behind a proxy, select the “Direct Connection” option.
- Select a mirror to download your packages from. Any option in the list will do.
- You’ll then be provided with a list of packages which you can download. Don’t select anything, just click “Next”. Doing so will result in the default applications being installed.
- When asking if you want to install dependencies, leave everything as their defaults and click “Next”. This will install everything you need to get Cygwin up and running.
- Double click on the “Cygwin64 Terminal” icon.
Set up an alias which points to the “setup-x86_64.exe” file you downloaded in Step 1, like so:
alias cyg-get="/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P"
Install the packages required to get Ansible up and running:
curl cygwin32-gcc-g++ gcc-core gcc-g++ git libffi-devel nano openssl openssl-devel python-crypto python2 python2-devel python2-openssl python2-pip python2-setuptools tree
pip install ansible
(Note that if you want to install a specific version, e.g 2.2, append ==2.2 to the end of the command.)
All done! You’re now ready to start using Ansible.
Note that your Cygwin home directory resides inside of the installation directory specified in Step 4.
Installing Additional Packages
The alias in Step 11 is a CLI version of what you saw in Step 8. To install a package using this alias you must know its name beforehand. If its name changes or you misspell it, the alias will not give you an error message.
If you’re having trouble using the alias because you’re unsure of a package’s name, open the “setup-x86_64.exe” application again and click “Next” until you get to the “Select Packages” screen. (Note that although it looks like you’re re-installing Cygwin, you are not. This is simply the way Cygwin’s package management works.)
In this screen you’re able to install and uninstall packages. To install a package, click on the icon to the left of the word “Skip”. Doing so will result in a crossed tick box appearing in the “Bin” column. Once you’ve selected the packages you want, click “Next” again to complete the installation.
As always, if you have any questions or have a topic that you would like me to discuss, please feel free to post a comment at the bottom of this blog entry, e-mail at firstname.lastname@example.org, or drop me a message on Reddit (OzNetNerd).
Note: The opinions expressed in this blog are my own and not those of my employer.