【问题标题】:ModuleNotFoundError when running playbook on Ubuntu/Ansible在 Ubuntu/Ansible 上运行 playbook 时出现 ModuleNotFoundError
【发布时间】:2021-06-04 11:01:59
【问题描述】:

我在 Ubuntu 18.04 上安装了 Ansible(在带有 WSL 的 Windows 上)。 Ansible 必须运行 playbook 来管理 Azure。当我尝试运行剧本(用于创建 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"}

我尝试了不同的方法,例如以不同的方式安装 Ansible(也使用 pip)。安装不同版本的 Python。安装了不同版本的 Ubuntu。

【问题讨论】:

  • 您是否尝试过安装azure 似乎丢失了?

标签: python azure ubuntu ansible


【解决方案1】:

您的 Ansible 安装缺少 Azure 模块。

参考the documentation,可以用下面的命令安装。

pip install 'ansible[azure]'

【讨论】:

  • 非常感谢!它现在正在工作。错过了这关键一步
猜你喜欢
  • 1970-01-01
  • 2020-04-04
  • 2018-02-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多