1
votes

Why am I getting this error when ManageIQ is trying to run ansible playbook? It says there is no module named azure-cli and I installed it using pip but still I get the same error.

Note: This issue happens only when ManageIQ tries to invoke ansible-playbook. If I manually run ansible-playbook it works. I'm not sure which session or venv ManageIQ uses but installing azure-cli using pip doesn't help.

exception   :   Traceback (most recent call last):\n  File \"/tmp/ansible_azure_rm_virtualmachine_info_payload_p_3b6x09/ansible_azure_rm_virtualmachine_info_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py\", line 232, in <module>\n    from azure.cli.core.auth.adal_authentication import MSIAuthenticationWrapper\nModuleNotFoundError: No module named 'azure.cli'\n
msg :   Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on eb150b51cab3's Python /usr/libexec/platform-python. 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
Because the given lib is not installed in the python version/path/venv/whatever..... your software is using to run your playbook. Find out how your software is installed, spot the correct python installation, pip install the lib in the correct location and it will work. This question (with the name of the lib varying) has been over-asked here and you will find plenty of examples by using the internal search engine on top of this page with some probably applying to your particular case. - Zeitounator