简体   繁体   English

在 Ubuntu/Ansible 上运行 playbook 时出现 ModuleNotFoundError

[英]ModuleNotFoundError when running playbook on Ubuntu/Ansible

I have Ansible installed on Ubuntu 18.04 (on Windows with WSL).我在 Ubuntu 18.04 上安装了 Ansible(在带有 WSL 的 Windows 上)。 Ansible has to run playbooks to manage Azure. Ansible 必须运行 playbook 来管理 Azure。 When I try to run a playbook (for creating a VNET) I get an error:当我尝试运行剧本(用于创建 VNET)时,出现错误:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'azure.common' fatal: [localhost]: FAILED: => {"changed", false: "msg". "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on XPS15'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"}

I tried different things, like installing Ansible on different ways (also with pip).我尝试了不同的方法,例如以不同的方式(也使用 pip)安装 Ansible。 Installing different versions of Python.安装不同版本的 Python。 Installed different versions of Ubuntu.安装了不同版本的 Ubuntu。

Your Ansible installation is missing the Azure module.您的 Ansible 安装缺少 Azure 模块。

Refering to the documentation , you can install it with the command below. 参考文档,您可以使用以下命令安装它。

pip install 'ansible[azure]'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM