python - Ansible 和 Opennebula:这个模块需要 pyone 才能工作
问题描述
我正在尝试使用Ansible模块(例如https://docs.ansible.com/ansible/latest/collections/community/general/one_image_info_module.html)管理在opennebula上运行的虚拟机
我在运行 macOS 10.15.6 和 python 3.8.5 的 Mac 上安装了 python 模块pyone ( http://docs.opennebula.io/5.12/integration/system_interfaces/python.html )
pip3 install pyone
pip3 list | grep pyone
pyone 5.12.4
我的剧本:
---
- hosts: localhost
tasks:
- name: "test"
community.general.one_image_info:
api_url: https://one.mycompany.com:2633/RPC2
api_username: myusername
api_password: mypassword
register: result
任务失败
fatal: [localhost]: FAILED! => {"changed": false, "msg": "This module requires pyone to work!"}
ansible localhost -m setup -a filter="ansible_python"
告诉我 ansible 使用的是相同的 python 版本。
在一个普通的python脚本中,我可以毫无问题地导入pyone,现在我不知道在哪里调查..
我希望有人能指出我正确的方向!提前谢谢了
PS:输出ansible --version
ansible 2.10.1
config file = /Users/fabian/projects/server-automation/ansible.cfg
configured module search path = ['/Users/fabian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]
Pyone 和我需要安装以使用其他 ansible 剧本的其他 python 模块位于:/usr/local/lib/python3.8/site-packages
解决方案
我同意它看起来确实使用了错误的 python 版本。您可以尝试将以下内容添加到您的剧本中吗?
vars:
ansible_python_interpreter: '/usr/bin/python3'
推荐阅读
- internationalization - Jasper Reports 无法使用 resourceBundle
- php - 计算部分关闭时间的开放时间
- python - 无法使用 `\n` 字符将字符串保存到文件
- ios - 线程1:UITableViewCell中的Exc Bad指令
- python - pyspark 数据框所有列中唯一元素的数量
- postgresql - SQL 中是否存在转义变量的机制?
- amazon-quicksight - 来自 postgres 上基于模式的多租户的 Quicksight 报告
- java - 重载可变参数方法时的奇怪行为
- android - 如何使用 Flutter 包在 Android 中加载文档
- html - 在 AngularJS 中显示动态列表项的更多/更少链接