Cygwin - 如何安装 ansible?

2024-04-23

如何使用 Cygwin 获取/安装 ansible?

我尝试了以下步骤,但在第 5 条期间(运行时“python setup.py 安装”)。步骤取自: 取自https://servercheck.in/blog/running-ansible-within-windows https://servercheck.in/blog/running-ansible-within-windows

1)下载并安装Cygwin,至少选择以下软件包(您可以在安装过程中选择软件包):

libyaml
libyaml-devel
curl
python (2.7.x)
python-crypto
python-openssl
python-paramiko
python-setuptools
git (2.1.x)
vim
openssh
openssl
openssl-devel

2) 下载并安装 PyYAML 和 Jinja2,因为它们无法通过 Cygwin 的安装程序获得:

1. Open Cygwin
2. Download PyYAML:
    curl -O https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz
3. Download Jinja2:
    curl -O https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz
4. Untar both downloads:
    tar -xvf PyYAML-3.10.tar.gz && tar -xvf Jinja2-2.6.tar.gz
5. Change directory into each of the expanded folders and run python "python setup.py install" to install each package.
6. Clone ansible from its repository on GitHub:
    git clone https://github.com/ansible/ansible /opt/ansible
    This was tested with Ansible version v1.6.6, change directory into /opt/ansible and checkout the correct tag: git checkout v1.6.6.
7. Add the following lines into your Cygwin .bash_profile:
    # Ansible settings
    ANSIBLE=/opt/ansible
    export PATH=$PATH:$ANSIBLE/bin
    export PYTHONPATH=$ANSIBLE/lib
    export ANSIBLE_LIBRARY=$ANSIBLE/library

8. At this point, you should be able to run ansible commands via Cygwin (once you restart, or enter source ~/.bash_profile to pick up the settings you just added). 
    Try ansible --version to display Ansible's version.

9. Passwordless ssh will need to be set up between your Windows machine and the deployment host(s)
    To enable passwordless ssh on Centos -  ssh-copy-id root@node
    To enable passwordless ssh on SuSE I followed the steps in this blog:
    http://www.firedaemon.com/blog/passwordless-root-ssh-public-key-authentication-on-centos-6
    install sshpass v1.05 on your Windows machine<br>

我在第 5 个项目符号期间遇到的错误是:

$ python setup.py install
running install
running build
running build_py
creating build
creating build/lib.cygwin-2.2.1-x86_64-2.7
creating build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/composer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/constructor.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/cyaml.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/dumper.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/emitter.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/error.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/events.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/loader.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/nodes.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/parser.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/reader.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/representer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/resolver.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/scanner.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/serializer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/tokens.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/__init__.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
running build_ext
creating build/temp.cygwin-2.2.1-x86_64-2.7
checking if libyaml is compilable
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/cygdrive/c/cygwin/include/python2.7 -c build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.c -o build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.o
checking if libyaml is linkable
gcc build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.o -L/cygdrive/c/cygwin/lib/python2.7/config -L/usr/lib -lyaml -o build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.exe
skipping 'ext/_yaml.c' Cython extension (up-to-date)
building '_yaml' extension
creating build/temp.cygwin-2.2.1-x86_64-2.7/ext
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/cygdrive/c/cygwin/include/python2.7 -c ext/_yaml.c -o build/temp.cygwin-2.2.1-x86_64-2.7/ext/_yaml.o
ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
                    ^
compilation terminated.
error: command 'gcc' failed with exit status 1

.

$ ansible --version
Traceback (most recent call last):
  File "/opt/ansible/bin/ansible", line 40, in <module>
    from ansible.utils.display import Display
  File "/opt/ansible/lib/ansible/utils/display.py", line 35, in <module>
    from ansible import constants as C
  File "/opt/ansible/lib/ansible/constants.py", line 30, in <module>
    from ansible.parsing.splitter import unquote
  File "/opt/ansible/lib/ansible/parsing/__init__.py", line 32, in <module>
    from ansible.parsing.vault import VaultLib
  File "/opt/ansible/lib/ansible/parsing/vault/__init__.py", line 82, in <module>
    from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256
  File "/cygdrive/c/cygwin/lib/python2.7/site-packages/cryptography/hazmat/primitives/hashes.py", line 15, in <module>
    from cryptography.hazmat.backends.interfaces import HashBackend
  File "/cygdrive/c/cygwin/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
  File "/cygdrive/c/cygwin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 84, in <module>
    packaging = pkg_resources._vendor.packaging
AttributeError: 'module' object has no attribute '_vendor'

更容易:

#!/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)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Cygwin - 如何安装 ansible? 的相关文章

随机推荐

  • GNU gdb 如何显示源文件名和符号行

    当使用 GNU gdb 调试 c 进程时 list 命令将打印行但不告诉我文件名 设置断点可以显示我想要的所有行和文件信息 但我不想设置断点并且必须禁用或删除它 gdb b oyss funtion Breakpoint 13 at 0x8
  • 如何在 Google Chrome 扩展程序中创建侧边栏?

    我正在考虑在 Google Chrome 中创建一个侧边栏扩展 并读到有一个 API 调用 Google 禁用了它 那么也许有人知道如何创建并有例子吗 不幸的是 侧边栏 API 工作最近已停止 https bugs chromium org
  • Tkinter 按钮在禁用和更新后仍然响应点击

    我希望按钮启动命令 然后在执行时禁用并在执行完成后再次启用 当我单击该按钮时 它似乎被禁用并且命令被执行 但是 当我在禁用按钮时单击该按钮时 该命令会在第一次执行完成后第二次执行 似乎在第二次单击后 该按钮确实被禁用了 因为我可以在禁用它时
  • 在 NASM 中使用 istruc 时:“警告:尝试初始化 BSS 部分‘.bss’中的内存:忽略 [-w+other]”

    在搜索这个错误时我发现this https stackoverflow com questions 65731514 nasm attempt to initialize memory in bss section 77001709问题 但
  • 我需要删除分割块之间的一点空间

    我的两个分割块之间有一点空间 https i stack imgur com ysU0R png https i stack imgur com ysU0R png在这里你可以看到我的问题 我不明白为什么这些块会这样 body main w
  • kafka启动失败(版本0.8.0 beta1)

    我正在尝试在独立模式 在ec2上 上使用zookeeper版本 3 3 6 启动kafka服务 所以我运行 1 sbt update 2 sbt package 3 sbt assembly package dependency 然后启动z
  • Instagram 基本显示 API - 出现无效平台应用程序错误

    我在邮递员上点击 oauth access token API 时收到无效平台应用程序错误 注意 对于 app id 我使用 Instagram 应用程序 ID 有什么解决办法吗 error type OAuthException code
  • var->myProperty 和 var.myProperty 之间的区别

    我是 Objective C 的新手 我有一些疑问 我发现您可以访问类的属性 例如var gt 我的属性也喜欢那样变量 myProperty 但我不知道2之间有什么区别 我在互联网上搜索了很多 但确实没有找到确凿的答案 抱歉 如果我有拼写错
  • 如何在浏览器中重定向/渲染 Pyodide 输出?

    我最近遇到了pyodide项目 https github com iodide project pyodide 我已经使用 Pyodide 构建了一个小演示 但是尽管我花了很多时间查看源代码 但对我来说如何重定向还不清楚printpytho
  • 实体类型 不是当前上下文模型的一部分

    这是模型优先的方法 我已经对此进行了广泛的研究 但还没有得出答案 我已尝试以下链接中的所有建议 这似乎是同样的问题 但没有解决方案实体类型 不是当前上下文模型的一部分 https stackoverflow com questions 49
  • 欧拉项目 #16 - C# 2.0

    我一直在与欧拉计划搏斗在 C 2 0 中 问题的关键在于 您必须计算并迭代 604 位长 或大约 的数字中的每个数字 然后将这些数字相加即可得出答案 这提出了一个问题 C 2 0没有可以处理这种计算精度的内置数据类型 我可以用一个第三方库
  • 在 TypeScript 中将数组作为参数传递

    我有两种方法 static m1 args any using args as array static m2 str string args any do something call to m1 m1 args 致电给m1 1 2 3
  • Azure Blob 存储与 Azure 驱动器

    我正在考虑迁移到 Windows Azure 而不是典型的托管 但我不确定如何最好地存储图像 经过搜索 我发现有 2 种可能的解决方案 Blob 存储或 Azure 驱动器 我研究了 Blob 存储 尽管我已经开始习惯这个想法 但它需要对我
  • 将证书文件加载到证书对象中

    我正在尝试将证书文件加载到证书对象中 但出现以下异常 java security cert CertificateParsingException invalid DER encoded certificate data at sun se
  • 我需要有关如何在 Windows Azure 上部署 ASP.NET 网站的演练或步骤

    我需要有关如何在 Windows Azure 上部署 ASP NET 网站的演练或步骤 以下是在 Windows Azure 上部署 ASP NET 网站的步骤 假设 gt 1 您已经创建了一个 ASP Net 网站 Step 1 在你的机
  • 如何检测android中某个渲染器区域内的触摸事件?

    在android中我举了一个旋转球体的例子在这里给出 https bitbucket org jimcornmell opengltexturedsphere 它创建了一个简单的应用程序 显示一个旋转球体 地球 现在 如果在手机显示屏上按下
  • 加密字段的部分搜索

    最近我被分配了一个问题 加密数据库字段 例如SSN 但仍然必须保持 部分搜索 工作 例如 SSN 123 45 6789 在数据库中被加密为 abcdxyz 当用户在搜索框中输入 2345 时 它必须出现在结果中 我们的数据库中有数百万条记
  • 截断表后序列不会重置

    我在截断表后使用 SELECT lastval 来获取错误的序列号 当我截断表时 我使用 SELECT lastval 我得到了错误的 ID Use the TRUNCATESQL 命令 对于单个表 语法如下 TRUNCATE TABLE
  • 如何处理特定类型集合的操作?

    在我的申请中的几个不同地方 我需要采取Seq SalesRow 并返回一个Map String SalesRow 其中字符串是国家 地区的名称 我需要在几个地方使用它 例如 我获取所有 SalesRows 的列表 并获取按国家 地区划分的全
  • Cygwin - 如何安装 ansible?

    如何使用 Cygwin 获取 安装 ansible 我尝试了以下步骤 但在第 5 条期间 运行时 python setup py 安装 步骤取自 取自https servercheck in blog running ansible wit