我正在尝试在 WSL2 (Ubuntu 20.04) 上为 Azure 开发安装 Ansible,但在尝试安装时看到以下输出:
> pip3 install 'ansible[azure]'
Looking in indexes
Processing /home/ross/.cache/pip/wheels/73/11/5d/0fd1ddb1a82c6afefa3f475b62f3f35c9224aef05a37d330ed/ansible-2.10.3-py3-none-any.whl
WARNING: ansible 2.10.3 does not provide the extra 'azure'
Requirement already satisfied: ansible-base<2.11,>=2.10.3 in /home/ross/.local/lib/python3.8/site-packages (from ansible[azure]) (2.10.3)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (5.3.1)
Requirement already satisfied: jinja2 in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (2.10.1)
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (2.8)
Requirement already satisfied: packaging in /home/ross/.local/lib/python3.8/site-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (20.4)
Requirement already satisfied: pyparsing>=2.0.2 in /home/ross/.local/lib/python3.8/site-packages (from packaging->ansible-base<2.11,>=2.10.3->ansible[azure]) (2.4.7)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from packaging->ansible-base<2.11,>=2.10.3->ansible[azure]) (1.14.0)
Installing collected packages: ansible
Successfully installed ansible-2.10.3
Run Code Online (Sandbox Code Playgroud)
结果,当我尝试使用 Azure 模块运行剧本时,它失败了:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on mypc's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
Run Code Online (Sandbox Code Playgroud)
我正在使用 python3 和 pip3。
为了为 Ansible 安装 Azure 模块,我还需要做些什么吗?
从 ansible 2.10 版本开始,相当多的模块已经移到外部集合中,不再是 ansible 核心的一部分。如果您打算使用它们,则需要在本地 ansible 环境中安装这些集合。
请按照指南进行安装azure.azcollection
。非常基本:
curl -O https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt
pip install -r requirements-azure.txt
rm requirements-azure.txt
ansible-galaxy collection install azure.azcollection
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1554 次 |
最近记录: |