Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Azure: faq

Abhijeet Kasurde edited this page Jul 9, 2018 · 1 revision

Problem description

When running ansible or ansible-playbook with azure modules, youm may meet error message "Do you have azure>=2.0.0 installed? No module named XXXX".

Actually you have already installed the Azure SDK libraries when installing ansible[azure] modules.

Root cause

  1. The libraries is installed by pip3 and under python 3.XXXX folder, but ansible uses python 2 to load libraries.

  2. You install azure libraries into different pip library path. Some may be in the system path like /usr/lib/..., some may be under your profile folder like ~/.username/lib/.... One of the library path is not in your PYTHONPATH, the python interpreter failed to find the library.

  3. There are many libraries named azure.mgmt...., they maybe installed in different folders. E.G. azure.mgmt.web is under /usr/lib/..., while azure.mgmt.compute is under ~/.username/lib.... When python try to import azure.mgmt.compute, it first imports the azure package. Unfortunately, your python find azure under /usr/lib for azure.mgmt.web, it searches mgmt.compute under this folder, failed and throw such exception. Here we need to move them into one directory.

Solve solution

  1. Check your packages is already installed, check whether the missing package is in the returned list.

    pip freeze
  2. Check whether the package path is in the PYTHONPATH:

    1. check your python sys path:

      python -c "import sys; print(sys.path)"
    2. find your target package path

      sudo find / | grep '<your missing package name>'
    3. check the step2's path is in the setp1's sys path. If not, add the PYTHONPATH by

      export PYTHONPATH=PYTHONPATH:<path found in previous step>
  3. Your azure.mgmt.XXX is installed in different path from other azure mgmt packages.

    1. find the azure/mgmt/web path by sudo find / | grep "azure/mgmt/web", and note it as web_path

    2. enter python bash by typing python

    3. find azure path by the following python script and not the azure.__file__ path as azure_path.

      import azure;
      azure.__file__;
      exit()
    4. copy the azure-mgmt-web package to the azure directory by

      sudo cp -rf <web-path>/azure/* <azure-path>/

(ARchived) Working groups

Working groups are now in the Ansible forum

Ansible project:
Community, Contributor Experience, Docs, News, Outreach, RelEng, Testing

Cloud:
AWS, Azure, CloudStack, Container, DigitalOcean, Docker, hcloud, Kubernetes, Linode, OpenStack, oVirt, Virt, VMware

Networking:
ACI, AVI, F5, Meraki, Network, NXOS

Ansible Developer Tools:
Ansible-developer-tools

Software:
Crypto, Foreman, GDrive, GitLab, Grafana, IPA, JBoss, MongoDB, MySQL, PostgreSQL, RabbitMQ, Zabbix

System:
AIX, BSD, HP-UX, macOS, Remote Management, Solaris, Windows

Security:
Security-Automation, Lockdown

Tooling:
AWX, Galaxy, Molecule

Communities

Modules:
unarchive, xml

Plugins:
httpapi

Wiki

Roles, Communication, Reviewing, Checklist, TODO

Clone this wiki locally