Reputation: 1636
I am trying to run ansible-playbook with these Python modules: https://github.com/dkorn/manageiq-ansible-module/tree/master/library
and I am failing with the following error:
from manageiq_client.api import ManageIQClient as MiqApi
ImportError: No module named manageiq_client.api
Now, I understand that I simply need to pip install the manageiq_client on the machine I run on but it is something I actually cannot do because I don't have root access to it to install anything. I was told to use this script:
But I am not sure how. Thanks in advance!
Upvotes: 0
Views: 3704
Reputation: 10039
That hacking/test-module script is for developing a module but it bypasses some of the ways ansible executes modules. If you just want to run a module / a playbook, don't use this.
So your problem is just installing a module as non-root, and having the python ansible executes pick it up. Options to try:
pip install --user
virtualenv
found a tip in the FAQ how to override python interpreter for modules. If you point it to a virtualenv's bin/python
, you can have ansible executed "outside" the venv while the module runs "inside" the venv:
virtualenv /tmp/v # can be anywhere
/tmp/v/bin/pip2 install manageiq_client
ansible-playbook --extra-vars ansible_python_interpreter=/tmp/v/bin/python2 add_provider.yml
(you can also set ansible_python_interpreter
in inventory file)
Upvotes: 3