DEV Community

Ježek
Ježek

Posted on

Run Ansible on Windows without WSL

Can Ansible run on Windows?
There is the simple, uncomplicated answer in ansible.com:

No, Ansible can only manage Windows hosts. Ansible cannot run on a Windows host natively, though it can run under the Windows Subsystem for Linux (WSL).

My friend, now I going to show you how you can run Ansible without WSL. Go ahead!

First of all in order to run Ansible on Windows without WSL you have to install Cygwin.

Once you have installed Cygwin for Windows you should to install relevant Cygwin packages for Ansible.


Install from the Internet

This is the easiest way to install Cygwin packages.

  1. Run cygwin-setup-x86_64.exe:
    Cygwin #1

  2. Press Next

  3. Choose Install from Internet, and press twice Next:
    Cygwin #2

  4. Select a local package directory, and press Next:
    Cygwin #3

  5. Select appropriate connection type, and press Next:
    Cygwin #4

  6. Choose appropriate download site, and press Next:
    Cygwin #5

  7. Select ansible and required for you packages, then press twice Next:
    Cygwin #6

  8. Wait for installation succeed
    Cygwin #7

  9. Run installed Cygwin64 Terminal, and check ansible version:

    $ ansible --version
    ansible 2.8.4
    
  10. Test whether ansible is working correctly:

    $ ansible 127.0.0.1  -m shell -a 'echo Hello world!'
    127.0.0.1 | CHANGED | rc=0 >>
    Hello world!
    

Congrats, my friend, you have installed Ansible on Windows without WSL!


Install from the local directory (portable)

This installation option is useful for those who do not have Internet access.

  1. First of all, you have to archive a folder where you have installed cygwin packages (in my case: c:\cygwin-packages\)

  2. Copy cygwin-setup-x86_64.exe and the archive to a computer w/o Internet access

  3. Extract archive to appropriate folders

  4. Run cygwin-setup-x86_64.exe, and press Next

  5. Choose Install from Local Directory, and press twice Next:
    Cygwin #2-1

  6. Select a local package directory where you have extracted the archive with packages, and press Next:
    Cygwin #2-2

  7. Select ansible and required for you packages, then press twice Next:
    Cygwin #2-3

  8. Wait for installation succeed

  9. Run installed Cygwin64 Terminal, and check ansible version:

    $ ansible --version
    ansible 2.8.4
    
  10. Test whether ansible is working correctly:

    $ ansible 127.0.0.1  -m shell -a 'echo Hello world!'
    127.0.0.1 | CHANGED | rc=0 >>
    Hello world!
    

Congrats, my friend, you have installed Ansible on Windows without WSL and Internet access on a computer!


Summary

In this post, we have seen:

  • how to install Ansible on Windows w/o WSL using Internet access
  • how to install Ansible on Windows w/o WSL and w/o Internet access

I hope this post was useful for you.
See you soon!

Top comments (0)