Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Windows Server » How to install Ansible on Windows with Cygwin

How to install Ansible on Windows with Cygwin

Posted on 01/03/202028/09/2023 Christian By Christian No Comments on How to install Ansible on Windows with Cygwin
installing Ansible

Ansible is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. It runs on many Unix-like systems and can configure both Unix-like systems as well as Microsoft Windows. Installing Ansible generally is pretty straight forward but on windows, it is a little bit complicated. Ansible uses the pywinrm package to communicate with Windows servers over WinRM. It is not installed by default with the Ansible package but can be installed, see the following link. Here are some related contents: How to view installed packages in Cygwin in Windows, how to configure Kerberos for Ansible Authentication, and how to determine Cygwin version.

Cygwin is free software that provides a Unix-like environment and software toolset to users of any modern x86 32-bit and 64-bit versions of Microsoft Windows. Cygwin consists of a Unix system call emulation library, cygwin1.dll, together with a vast set of GNU and other free software applications organized into a large number of optional packages. Among these packages are high-quality compilers and other software development tools, an X11 server, a complete X11 development toolkit, GNU emacs, TeX and LaTeX, OpenSSH (client and server), and much more, including everything needed to compile and use PhysioToolkit software under MS-Windows.

If you wish to install Ansible on Windows, follow these steps.
Note: Cygwin is a simple program that allows UNIX commands to be run on Windows systems. To automate Ansible for VMware Infrastructure Automation.

1. Install cygwin: Here are the steps below to install Cygwin
– From https://cygwin.com/install.html
– Download the installer

Windows

– Run the setup (install) the file that was just downloaded.

Cygwin installation

– on the next page, select the Installation Type

Ansible setup

– Select the root directory (will leave as default)
– Also, select install for all users if multiple users will be using the server

installing Ansible

– Select the Local Package Directory will store installation,( I will leave this as default as it is a test environment). It usually takes (assumes) the location of the initial download file (setup).

C:\Users\tester\Downloads

– Select Connection Type (Select Direct Connection)

Windows

– Choose a download site (will select the first by default)

Cygwin installation

– Click on Next
– This will continue the installation on Cygwin on your windows system and show the progress bar of the installation.

Ansible setup

– Select Packages to install

Windows

2. Install the following packages from the list

- curl
- python
- python-setuptools
- python-crypto
- openssl
- openssl-devel
- libffi-devel
- gcc-g++
- vim
- git

To install, you can use the search menu or expand the packages and from the New drop-down list associated with each package,

– Select install as shown below if you wish to install all the packages associated with the Editor.

Ansible setup

– Or use the search menu for a single package and install.

Cygwin installation

 – For Git

– For Libffi-Devel  which is a portable foreign function interface library

– Click on Next and will prompt a windows allowing you to review and confirm changes.

– This step is a two-step process and will download and then install the following packages on your device.

– Installing the Cygwin onto our system

Note: Do not interrupt this installation as this can take a lot of time.

– Click on Finish when the installation is complete

– Lastly, ensure to set the environment variable for Cygwin (This will enable you to run Cygwin from the terminal). Setting the path and environment variables will differ depending on the version of Windows you have on your computer. Choose a link below for your version of Windows.

– Access the System properties
– Click on System Properties via the Explorer window (Note: There are different steps to launch this window).

Previously this will open the control panel on the fly, but now it will open the Windows About Settings page.

– Then Click on System info and this will open the control panel window.

– Click on Advanced System settings

- Click on Environment Variable
- In the Environment Variable window
- Search for “Path”
- Double click or select and click on edit.
- On the Edit environment variable
- Click on New
- Add the following parameter

– Select on ok.

Note:
– This will ensure all windows are confirmed and ok is clicked about 3x.
– You may have to restart your environment or else this will not work on the fly in order to use Cygwin on Windows CMD.

The steps below are necessary only if you want to explore other methods of installing Ansible on Windows. You can avoid the steps below if you wish to install Ansible with Cygwin as shown below.

For other methods of installing Ansible on Windows, follow the steps below.

Install PIP:  What is PIP?  It is an alternate installer for python packages that many uses in managing python related package activities.

Right-click “Cygwin64 terminal on your desktop” and run as Administrator or run from the CMD because UNIX commands can be run now from the command prompt.

For more information about easy_install and PIP, see https://packaging.python.org/discussions/pip-vs-easy-install/

To install PIP, run the command below.
-Note: If you do not have the right python packages installed, the easy_install pip will not work

easy_install-2.7 pip

Install Pywinrm: Ansible uses the pywinrm package to communicate with Windows servers over WinRM. It is not installed by default with the Ansible package, but can be installed by running the following.

pip install "pywinrm>=0.3.0"

Install Ansible:
Method 1: The best way to achieve this is to install Ansible via Cygwin.
– Select the packages alongside other packages and install them.

Method 2. Use the command below.

- pip install Ansible

Note: You need also to rebase all the packages to solve the problem of forking. For this perform the following below.

  1. Rebase-trigger full
  2. Close Cygwin shells (or even reboot your windows)
  3. Run Cygwin installer again and just click on “Next” until you reach the end of the installation, then Cygwin will rebase all the packages.
Building wheel for ansible (setup.py) ... done
  Created wheel for ansible: filename=ansible-2.9.5-cp27-none-any.whl size=16162543 sha256=b83577e80aa8c47d9647ed665de4bf59d7a45e7c3d128dc5f565ab9dc9841d32

Stored in directory: /home/tester/.cache/pip/wheels/3b/ab/74/4629c803bf5475edf5c0369f5cb95e834bdd2f7d70f439a027
Successfully built ansible
Installing collected packages: ansible
Successfully installed ansible-2.9.5
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

To run Ansible on other Operating Systems, see https://techdirectarchive.com/2020/02/23/ansible-installation-and-configuration-on-ubuntu/

After installing Ansible, using the version to see if Ansible is correctly installed.

$ ansible --version
$ ansible --version
ansible 2.9.5
  config file = None
  configured module search path = [u'/home/tester/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.16 (default, Mar 20 2019, 12:15:19) [GCC 7.4.0]

To see the default host files, navigate to the path C:\cygwin64\etc\ansible

Now that Ansible is installed, let’s perform our first test. The below steps and command helps to test Ansible locally. Running some commands like ping by using the ping Ansible module against the localhost.

You will get a success message displayed in green after completion of the ping commands. – Response will to the ping command is the “pong” output.

ansible localhost -m ping
Rate this post

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Windows Server Tags:Configuration Management Tool, Cygwin, Microsoft Windows, Orchestration Tool

Post navigation

Previous Post: Various ways to hide Windows Taskbar
Next Post: How to install additional packages via Cygwin

Related Posts

  • Windows Server 2016 1 1
    Merits and demerits of Local System Account and Service Logon Account Windows Server
  • screenshot 2020 03 31 at 22.22.43
    How to create, edit and delete a scheduled task via the Command Prompt Windows Server
  • Slide1
    Enable Exploit Protection feature on Windows using the Windows Security App, Microsoft Endpoint Configuration Manager, and Group Policy Windows
  • article 1280x720.166f8634
    Configure Windows client to obtain IP Address via a DHCP Server Windows Server
  • group policy 1280x720 1
    Error: The processing of Group Policy failed because of lack of network connectivity to a DC. This may be a transient condition. A success message would be generated once the machine gets connected Windows Server
  • article 1280x720.192a2586 1 1
    Fix Error 0xc1510111: You do not have permission to mount and modify this image Windows Server

More Related Articles

Windows Server 2016 1 1 Merits and demerits of Local System Account and Service Logon Account Windows Server
screenshot 2020 03 31 at 22.22.43 How to create, edit and delete a scheduled task via the Command Prompt Windows Server
Slide1 Enable Exploit Protection feature on Windows using the Windows Security App, Microsoft Endpoint Configuration Manager, and Group Policy Windows
article 1280x720.166f8634 Configure Windows client to obtain IP Address via a DHCP Server Windows Server
group policy 1280x720 1 Error: The processing of Group Policy failed because of lack of network connectivity to a DC. This may be a transient condition. A success message would be generated once the machine gets connected Windows Server
article 1280x720.192a2586 1 1 Fix Error 0xc1510111: You do not have permission to mount and modify this image Windows Server

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • Configure Data Deduplication on Windows Server
    How to Configure Data Deduplication on Windows Server 2022 Windows Server
  • plain blue background
    Request a certificate signing request in Windows using Microsoft Management Console Windows Server
  • nodee
    How to install Cypress on Windows and perform Automation Windows
  • AZMFeature
    Performance and Diagnostics in Microsoft Cloud with Azure Monitor AWS/Azure/OpenShift
  • ddedw
    You require permission from trustedinstaller: How to delete or rename files protected by Trusted Installer Network | Monitoring
  • opsworks for automate blog
    How to setup Chef Automate on AWS Configuration Management Tool
  • how to install ms office 365 title
    How to complete Microsoft Office 365 Family Subscription Mac
  • ADDS Already Contain A Computer Account
    How to fix ADDS already contain a computer account Windows Server

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,819 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.