Ansible Azure library version issues #69672
Labels
affects_2.9
This issue/PR affects Ansible v2.9
azure
bug
This issue/PR relates to a bug.
cloud
collection:azure.azcollection
collection:gavinfish.azureblob
collection
Related to Ansible Collections work
module
This issue/PR relates to a module.
needs_collection_redirect
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md
python3
support:community
This issue/PR relates to code supported by the Ansible community.
traceback
This issue/PR includes a traceback.
SUMMARY
I have an app that I running in a Docker container to create Azure resources utilizing Ansible and Python. I have installed the necessary arm modules with
pip install ansible[azure]
to enable Ansible to work with Azure. For my Python script i am using the current azure-storage-blob, azure-mgmt-resource, and azure-common libraries. Everything with my app works and does what it needs to do locally.The required Ansible libraries for Azure are listed here These versions are extremely outdated. The problem I am facing is on the build of the Docker image, the required libraries for Ansible are being installed (using
pip install ansible[azure]
) and then when I install the necessary libraries for the Python script (azure-storage-blob, azure-mgmt-resource, and azure-common) pip is blowing away the old versions needed for Ansible. Those three that I need for Python are in the list of required Ansible libraries hence why they are being blown away. It's a lose lose situation. If I want the python script to work, I need relatively current Azure libraries. If I want my playbooks to work, I need to use the very dated libraries. Is there anything I can do to get these libraries from uninstalling each other? I am not too sure if there is anything that can be done, but I think its definitely something that should be brought up.I believe the azure-storage-blob module is what is breaking my playbook. In the list of libraries needed for Ansible, it requires the module azure-storage 0.35.1. This has been deprecated for a long time now and was replaced by azure-storage-blob. azure-storage-blob is on version 12.0.
Examples of the uninstalls during the Docker run:
Installing collected packages: azure-mgmt-resource
Attempting uninstall: azure-mgmt-resource
Found existing installation: azure-mgmt-resource 2.1.0
Uninstalling azure-mgmt-resource-2.1.0:
Successfully uninstalled azure-mgmt-resource-2.1.0
Successfully installed azure-mgmt-resource-9.0.0
2.1 is what's needed and being used still? They are up to 9.0.
Installing collected packages: azure-core, msrest, azure-storage-blob
Attempting uninstall: msrest
Found existing installation: msrest 0.6.1
Uninstalling msrest-0.6.1:
Successfully uninstalled msrest-0.6.1
Successfully installed azure-core-1.5.0 azure-storage-blob-12.3.0 msrest-0.6.14
pip3 freeze | grep azure
results:These are the versions that I ran the playbook with below.
azure-cli-core==2.0.35
azure-cli-nspkg==3.0.2
azure-common==1.1.25
azure-core==1.5.0
azure-graphrbac==0.40.0
azure-keyvault==1.0.0a1
azure-mgmt-authorization==0.51.1
azure-mgmt-automation==0.1.1
azure-mgmt-batch==5.0.1
azure-mgmt-cdn==3.0.0
azure-mgmt-compute==4.4.0
azure-mgmt-containerinstance==1.4.0
azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==4.4.0
azure-mgmt-cosmosdb==0.5.2
azure-mgmt-devtestlabs==3.0.0
azure-mgmt-dns==2.1.0
azure-mgmt-hdinsight==0.1.0
azure-mgmt-iothub==0.7.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-loganalytics==0.2.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-monitor==0.5.2
azure-mgmt-network==2.3.0
azure-mgmt-nspkg==2.0.0
azure-mgmt-rdbms==1.4.1
azure-mgmt-redis==5.0.0
azure-mgmt-resource==9.0.0
azure-mgmt-servicebus==0.5.3
azure-mgmt-sql==0.10.0
azure-mgmt-storage==3.1.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.41.0
azure-nspkg==2.0.0
azure-storage==0.35.1
azure-storage-blob==12.3.0
msrestazure==0.5.0
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
This is just a snippet of the playbook I am using but it is erroring out because the azure-storage-blob library and azure-storage library cannot coexist. I know this because running the playbook without the azure-storage-library installed, it works.
EXPECTED RESULTS
ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name 'PageBlobService'
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on c3950e31c1f7's Python /usr/bin/python3. Please read module documentation and install 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"}
The text was updated successfully, but these errors were encountered: