This is an old revision of the document!
Overview
If you want to install Ansible on windows, you will encounter the fact that Ansible doesn't run on windows. At least not natively. There are 2 ways how to operate with ansible on Windows:
- Using Cygwin
- Installing ubuntu Subsystem (only Windows 10+)
We will do it both ways here :)
Cygwin
Downloading and installing Cygwin is fairly easy. Just download the Cygwin and select ansible in the package:
After that you will have the ansible command
Cygwin intro
andonovj@DESKTOP-N65RKDP /cygdrive/d/Virtuals/Docker Swarm $ ansible --version ansible 2.8.4 config file = /etc/ansible/ansible.cfg configured module search path = ['/home/andonovj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.7/site-packages/ansible executable location = /usr/bin/ansible python version = 3.7.4 (default, Jul 21 2019, 14:43:25) [GCC 7.4.0]
Ubuntu SubSystem
The ubuntu subsystem is available from the windows store and can be installed on Windows 10+ After you install the ubuntu WS, we have to install couple other stuff before ansible :) So let's get going. Firstly, we have to update our repo:
Update Repo
root@DESKTOP-N65RKDP:~# apt-get update Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB] Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [651 kB] Get:7 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [211 kB] Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [23.8 kB] -----------------------------------------------------------------------------------------------
Then we have to install the pip:
Installing Pip
root@DESKTOP-N65RKDP:~# apt-get install python3-pip Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libfreetype6 Use 'apt autoremove' to remove it. The following additional packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gcc-8-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1 libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgcc1 libgomp1 libisl19 libitm1 liblsan0 libmpc3 libmpx2 libpython3-dev libpython3.6 libpython3.6-dev libpython3.6-minimal libpython3.6-stdlib libquadmath0 libssl1.1 libstdc++-7-dev libstdc++6 libtsan0 libubsan0 linux-libc-dev make manpages-dev python-pip-whl python3-crypto python3-dev python3-distutils python3-keyring python3-keyrings.alt python3-lib2to3 python3-secretstorage python3-setuptools python3-wheel python3-xdg python3.6 python3.6-dev python3.6-minimal Suggested packages: binutils-doc cpp-doc gcc-7-locales debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc bzr libstdc++-7-doc make-doc python-crypto-doc gnome-keyring libkf5wallet-bin gir1.2-gnomekeyring-1.0 python-secretstorage-doc python-setuptools-doc python3.6-venv python3.6-doc binfmt-support The following NEW packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgomp1 libisl19 libitm1 liblsan0 libmpc3 libmpx2 libpython3-dev libpython3.6-dev libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev make manpages-dev python-pip-whl python3-crypto python3-dev python3-distutils python3-keyring python3-keyrings.alt python3-lib2to3 python3-pip python3-secretstorage python3-setuptools python3-wheel python3-xdg python3.6-dev The following packages will be upgraded: gcc-8-base libexpat1 libgcc1 libpython3.6 libpython3.6-minimal libpython3.6-stdlib libssl1.1 libstdc++6 python3.6 python3.6-minimal 10 upgraded, 57 newly installed, 0 to remove and 133 not upgraded. Need to get 92.6 MB of archives. After this operation, 249 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libexpat1 amd64 2.2.5-3ubuntu0.2 [ -----------------------------------------------------------------------------------------------------------------------
Really finally, we can install the ansible using the pything indexing or the Pip
Install ansible
root@DESKTOP-N65RKDP:~# apt-add-repository ppa:ansible/ansible Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. http://ansible.com/ More info: https://launchpad.net/~ansible/+archive/ubuntu/ansible Press [ENTER] to continue or Ctrl-c to cancel adding it. Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Get:4 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic InRelease [15.9 kB] Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Get:6 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic/main amd64 Packages [692 B] Get:7 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic/main Translation-en [472 B] Fetched 17.0 kB in 4s (3854 B/s) Reading package lists... Done root@DESKTOP-N65RKDP:~# apt-get install ansible -y Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libfreetype6 Use 'apt autoremove' to remove it. The following additional packages will be installed: libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-asn1crypto python-cffi-backend python-crypto python-cryptography python-enum34 python-httplib2 python-idna python-ipaddress python-jinja2 python-markupsafe python-minimal python-paramiko python-pkg-resources python-pyasn1 python-setuptools python-six python-yaml python2.7 python2.7-minimal sshpass Suggested packages: