Cygwin - How to install ansible?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 23:59:19

Much easier:

#!/bin/sh
type apt-cyg || exit
apt-cyg install git python-{jinja2,six,yaml}
git clone --depth 1 git://github.com/ansible/ansible
cd ansible
PATH+=:~+/bin
export PYTHONPATH=~+/lib
ansible --version

Result

ansible 2.0.0 (devel 2a50957ad8) last updated 2015/09/15 21:22:17 (GMT -500)

Assuming Cygwin is installed:

  • Open up a Cygwin Terminal
  • alias cyg-get="/path/to/cygwin/setup/package/setup-x86_64.exe -q -P"
  • cyg-get cygwin32-gcc-g++,gcc-core,gcc-g++,git,libffi-devel,nano,openssl,openssl-devel,python-crypto,python3,python3-devel,python3-openssl,python3-pip,python3-setuptools,python3-devel,tree,wget,zip,make
  • The lack of spaces and the presence of commas here is important!
  • Upgrade pip via pip3 install --upgrade pip
  • pip install ansible

Notes:

The cyg-get alias allows you to install all packages via the command line instead of searching in the Cygwin UI.

The ansible installation includes a step where "Running setup.py bdist_wheel for pynacl" is executed - this takes at least half an hour but does eventually complete.

Although Ansible may work in Cygwin, note that it is not officially supported and it doesn't sound like it will be in the near future.

Note running Ansible from a Windows control machine is NOT a goal of the project. Refrain from asking for this feature, as it limits what technologies, features, and code we can use in the main project in the future. A Linux control machine will be required to manage Windows hosts.

Cygwin is not supported, so please do not ask questions about Ansible running from Cygwin.

Taken from the Ansible Documentation

One alternative to consider is running a Linux virtual machine on your Windows host and use that as your Ansible controller.


    1. download cygwin
    2. on the "Select Packages" page, select "Category" from the View (on top left)
    3. mark "Devel" to "Install" (you will change the "Default" to "Install"
    4. mark "Python" to "Install"
    5. from "Web" select "wget"
    6. from "Net" select "Openssh"
    7. progress to install the packages with "Next"
    8. go to the destination folder where you installed cygwin
    9. right click "Cygwin.bat" and run as Administrator
    10. write "easy_install-2.7 pip"
    11. write "pip2 install ansible"


You need also to rebase all the packages to solve the problem of forking, for this then write:

  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.

After that you can use ansible without any problem (I hope so you will have the same situation as me, as it's working for me)

It took me a lot of days searching and trying to solve installing ansible on Windows 10 Home Edtion

Try this apt-get remove python-cryptography, also you may need to install paramiko-1.10.0.tar.gz manually.

➤ ansible --version ansible 2.1.0

I had a problem with "resolve symbolic links" - so i coudn't install it from "pip install /path/absible.tar.gz" But i unpacked it (under root = administrator) to folder and installed from folder, not archive. And - oh, it works - ansible was installed to cygwin.

This worked for me:

~$ cat setup_ansible_cygwin.sh

#!/bin/sh

echo binutils,curl,gcc-g++,git,gmp,libffi-devel,libgmp-devel,\
make,nano,openssh,openssl-devel,python-crypto,python-paramiko, \
python2,python2-devel,python2-openssl,python2-pip,python2-setuptools |\
        tr ',' ' ' |\
        xargs apt-cyg install

apt-cyg remove python2
apt-cyg install python2

pip2 install --upgrade pip
pip2 install ansible
# inside: Installing collected packages: MarkupSafe, jinja2, PyYAML, ansible

Steps for Ansible 2.7.6 and Python3 and Cygwin 2.11.2(0.329/5/3)

  1. Having Cygwin installed
  2. Install python3
c:\cygwin64-setup>setup-x86_64.exe -q -P python3
$ python3 --version
  1. Install pip
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python3 get-pip.py
$ pip --version
  1. Install dev tools (for Ansible)
c:\cygwin64-setup>setup-x86_64.exe -q -P make
c:\cygwin64-setup>setup-x86_64.exe -q -P gcc-g++
c:\cygwin64-setup>setup-x86_64.exe -q -P python3-devel
c:\cygwin64-setup>setup-x86_64.exe -q -P libffi-devel
c:\cygwin64-setup>setup-x86_64.exe -q -P openssl-devel
c:\cygwin64-setup>setup-x86_64.exe -q -P openssh
  1. Install ansible
$ pip install ansible
$ ansible --version
  1. Check which ssh is used (https://serverfault.com/a/913435)
% which ssh
/cygdrive/c/WINDOWS/System32/OpenSSH/ssh

Note: if not cygwin ssh is used (like above) change env PATH variable for cygwin or change Ansible inventory hosts file items with flag ansible_ssh_executable=/usr/bin/ssh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!