使用 Git-bash 在 Windows 中安裝 Ansible

使用 Git-bash 在 Windows 中安裝 Ansible

我正在嘗試安裝安西布爾 開源自動化平台在 Windows 上。有很多關於如何使用 Cygwin 安裝 Ansible 的指南(例如1,2)。

但是,我已經在 Windows 7 上安裝了 Git-Bash(來自這裡)。

是否可以在 Windows 中的 Git-Bash 中安裝 Ansible。

編輯:

更新:

我在使用 Cygwin 時遇到了很多問題。

  1. 我安裝了Cygwin。
  2. 然後我做了pip install PyYAML, jinja, paramiko, cryptography等等pip install ansible。它沒有安裝paramikocryptography成功。兩個包裹libffincurses發現遺失。我重新運行 Cygwin 安裝程式並安裝了libffi.我找不到ncurses
  3. 我重新啟動 Cygwin 並重試pip install paramiko cryptography。他們沒有再次安裝,並給出了與libffincurses丟失相同的錯誤訊息。那時,我放棄並卸載了 Cygwin。我沒有再嘗試。

編輯2: 為了回答這個問題,我這樣做了:

答案1

Git-Bash不足以安裝ansible,它缺少建置工具。

我建議你嘗試 msys2(git-bash 的基礎),一旦安裝了所有 ansible 建置依賴項,你就可以透過pip install ansible.

答案2

工作說明在這裡:https://stackoverflow.com/questions/32596203/cygwin-how-to-install-ansible

基本上,您需要安裝 Cygwin 和建置工具以及可用的 Python 模組。然後你運行:

pip2 install ansible

答案3

我使用適用於 Linux 的 Windows 子系統,Ansible 在那裡運作得很好。您可以透過 PowerShell 腳本啟用該功能來快速嘗試: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 然後前往 Microsoft Store 並選擇您的發行版:

  • 烏班圖
  • 開放SUSE
  • 斯萊斯
  • 卡利Linux
  • Debian GNU/Linux

相關內容