Ansible and Opennebula: This module requires pyone to work

510 views Asked by At

I am trying to manage my VMs running on opennebula using the Ansible modules (e.g. https://docs.ansible.com/ansible/latest/collections/community/general/one_image_info_module.html )

I installed the python module pyone on my mac running macOS 10.15.6 with python 3.8.5 ( http://docs.opennebula.io/5.12/integration/system_interfaces/python.html )

pip3 install pyone

pip3 list | grep pyone
pyone                 5.12.4

My playbook:

---
- 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

The task fails with

fatal: [localhost]: FAILED! => {"changed": false, "msg": "This module requires pyone to work!"}

ansible localhost -m setup -a filter="ansible_python" tells me that ansible is using the same python version.

In a normal python script I can import pyone without problems and now I am clueless where to investigate..

I hope someone can point me in the right direction! Many thanks in advance

P.S.: Output of 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 and other python modules I needed to installed to use other ansible playbooks are located here: /usr/local/lib/python3.8/site-packages

2

There are 2 answers

0
jorel On

I agree that it really looks like a wrong python version is used. Could you try to add the following to your playbook?

  vars:
    ansible_python_interpreter: '/usr/bin/python3'
0
spl5 On

try sudo pip3 install. worked for me:

sudo pip3 install pyone