=====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, but before we continue it is important to mention that ansible is disered state / agentless / automation system. In order for it to communicate with the targets it relies on: * WinRm - For Windows Systems * SSH - For Linux Systems So let's continue all :) ====Cygwin==== Downloading and installing Cygwin is fairly easy. Just download the Cygwin and select ansible in the package: {{:ansible_cygwin_package.jpg?800|}} After that you will have the ansible command 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: 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: 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 ----------------------------------------------------------------------------------------------------------------------- Really finally, we can install the ansible using the pything indexing or the Pip 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. ====Communicate with Windows==== To communicate with windows we have to install couple other modules: * Pywinrm - Used for communication with Windows * Pywinram[credssp] - Used for authentication root@DESKTOP-N65RKDP:~# pip3 install pywinrm Collecting pywinrm Downloading https://files.pythonhosted.org/packages/fc/88/be0ea1af44c3bcc54e4c41e4056986743551693c77dfe50b48a3f4ba1bf7/pywinrm-0.4.1.tar.gz Requirement already satisfied: requests>=2.9.1 in /usr/lib/python3/dist-packages (from pywinrm) Collecting requests_ntlm>=0.3.0 (from pywinrm) Downloading https://files.pythonhosted.org/packages/03/4b/8b9a1afde8072c4d5710d9fa91433d504325821b038e00237dc8d6d833dc/requests_ntlm-1.1.0-py2.py3-none-any.whl root@DESKTOP-N65RKDP:~# pip3 install pywinrm[credssp] Requirement already satisfied: pywinrm[credssp] in /usr/local/lib/python3.6/dist-packages Requirement already satisfied: six in /usr/lib/python3/dist-packages (from pywinrm[credssp]) Requirement already satisfied: requests>=2.9.1 in /usr/lib/python3/dist-packages (from pywinrm[credssp]) Requirement already satisfied: requests-ntlm>=0.3.0 in /usr/local/lib/python3.6/dist-packages (from pywinrm[credssp]) Requirement already satisfied: xmltodict in /usr/local/lib/python3.6/dist-packages (from pywinrm[credssp]) Collecting requests-credssp>=1.0.0; extra == "credssp" (from pywinrm[credssp]) Downloading https://files.pythonhosted.org/packages/e8/b9/43cd780 =====Install Collections===== From Ansible 2.10 or so, you have to install collections in Ansible, if you want to use them: ====Install Oracle OCI==== To install Oracle collection: (oracle.oci) just run the following commands: julien.andonov@julienaonovsMBP oci-ansible-collection % ansible-galaxy collection install oracle.oci Starting galaxy collection install process Process install dependency map Starting collection install process Downloading https://galaxy.ansible.com/download/oracle-oci-2.36.0.tar.gz to /Users/julien.andonov/.ansible/tmp/ansible-local-881012o19jld_/tmp_jma691c/oracle-oci-2.36.0-t77z2xqd Installing 'oracle.oci:2.36.0' to '/Users/julien.andonov/.ansible/collections/ansible_collections/oracle/oci' oracle.oci:2.36.0 was installed successfully julien.andonov@julienaonovsMBP oci-ansible-collection %