0

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!

1 Answer 1

3

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
  • run in a virtualenv
  • set PYTHONPATH manually (slightly tricky to be sure you're only adding...)
  • 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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.