Git-Bash is insufficient to install ansible, it is lack of build tools.
I recommend you try msys2(which git-bash base on), once install all ansible build dependencies, you can install ansible just by pip install ansible.
Slowly convinced that Ansible is impossible to install on Windows.
pip - Installing Ansible Python package on Windows - Stack Overflow
Ansible on Windows 10 via WSL - working without issue
Preferred way to develop with Ansible on Windows host?
I use vscode on Windows and the SSH extension and open the folder containing my playbooks on my Ansible control node server over SSH.
More on reddit.comVideos
Git-Bash is insufficient to install ansible, it is lack of build tools.
I recommend you try msys2(which git-bash base on), once install all ansible build dependencies, you can install ansible just by pip install ansible.
Working instructions are here: https://stackoverflow.com/questions/32596203/cygwin-how-to-install-ansible
Basically you install Cygwin and build tools, and available Python modules. Then you run:
pip2 install ansible
I've checked everything and there is no information for installing the platform. And I need this for a class to do my assignments. But even the professor didn't bother to give us any clues in installing ansible whatsoever, expecting the entire class to know on the get go.
I'm just convinced I need a MAC to even run Ansible at all.
Installing Ansible on Windows is cumbersome. My advice is not a direct solution on how to install Ansible on Windows, but rather a workaround.
I use a Docker container with Ansible for developing playbooks on my Windows machine. You'd need Docker for Windows on your machine.
Here's the Dockerfile:
FROM alpine:3.7
ENV ANSIBLE_VERSION=2.5.4
ENV BUILD_PACKAGES \
bash \
curl \
tar \
nano \
openssh-client \
sshpass \
git \
python \
py-boto \
py-dateutil \
py-httplib2 \
py-jinja2 \
py-paramiko \
py-pip \
py-setuptools \
py-yaml \
ca-certificates
RUN apk --update add --virtual build-dependencies \
gcc \
musl-dev \
libffi-dev \
openssl-dev \
python-dev && \
set -x && \
apk update && apk upgrade && \
apk add --no-cache ${BUILD_PACKAGES} && \
pip install --upgrade pip && \
pip install python-keyczar docker-py boto3 botocore && \
apk del build-dependencies && \
rm -rf /var/cache/apk/* && \
mkdir -p /etc/ansible/ /ansible && \
echo "[local]" >> /etc/ansible/hosts && \
echo "localhost" >> /etc/ansible/hosts && \
curl -fsSL https://releases.ansible.com/ansible/ansible-${ANSIBLE_VERSION}.tar.gz -o ansible.tar.gz && \
tar -xzf ansible.tar.gz -C /ansible --strip-components 1 && \
rm -fr ansible.tar.gz /ansible/docs /ansible/examples /ansible/packaging
ENV ANSIBLE_GATHERING=smart \
ANSIBLE_HOST_KEY_CHECKING=false \
ANSIBLE_RETRY_FILES_ENABLED=false \
ANSIBLE_ROLES_PATH=/ansible/playbooks/roles \
ANSIBLE_SSH_PIPELINING=True \
PYTHONPATH=/ansible/lib \
PATH=/ansible/bin:$PATH \
ANSIBLE_LIBRARY=/ansible/library \
EDITOR=nano
WORKDIR /ansible/playbooks
ENTRYPOINT ["ansible-playbook"]
Build the docker container with the docker build command. Afterwards you can create a small bash script that executes the docker run command and mounts your current directory into the container. You may call it ansible-playbook.sh:
winpty docker run --rm -it -v /$(pwd):/ansible/playbooks <name of your container> $@
Now you will be able to launch Ansible playbook with ./ansible-playbook.sh <your playbook> in GIT BASH. If you'd like to run this in PowerShell you would probably need to remove the winpty command, but I did not test this in PS yet.
It is not the finest solution but it gets the work done. Hope it helps you, too.
I've managed to install ansible on Windows 10 with following steps (ran in powershell):
- Clone ansible repository, e.g. to ansible folder
- pip3 install -e .\ansible\
You may also need to make a symbolic link, however, shouldn't be neccessary:
New-Item -ItemType SymbolicLink -Name ansible_release.py -Target .\lib\ansible\release.py
Ansible will be somewhat unusable for development, because it's using some Unix-only modules like grp or pwd. For example, you won't be able to run unit tests (e.g. module_utils/basic.py imports grp and pwd). Downloading grp.py to site-packages folder won't help.
To have a smoother experience, I recommend installing WSL (Windows Subsystem for Linux) plus install python with pip and just run pip install ansible. Here's how you can use WSL for development in Visual Studio Code