安装 'ansible[azure]' 缺少依赖项 'msrest'

时间:2021-06-13 15:50:43

标签: azure ansible

当我使用 pip install 'ansible[azure] 安装 Azure 扩展并尝试使用 ansible-playbook playbook.yml 运行剧本时,我收到以下错误:

ModuleNotFoundError: No module named 'msrest'

它还提到了 Failed to import the required Python library (msrestazure)

我从 official ansible docs for Azure 那里得到了这个程序。

此处为完整错误:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'msrest'
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (msrestazure) on DESKTOP-JL4F430's Python /home/pomatti/projects/personal/docker-swarm-cluster-with-ansible/env/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"}

Ansible 版本:

$ ansible --version
ansible [core 2.11.1]

1 个答案:

答案 0 :(得分:0)

问题是来自 ansible 版本 >= 2.9 的集合,其中已发布和附加内容正在移动。

如果您不想使用 Galaxy,这应该可以解决问题:

$ pip install -r https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt

$ pip install 'ansible'