Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible Azure library version issues #69672

Closed
mo-moneyy opened this issue May 22, 2020 · 4 comments
Closed

Ansible Azure library version issues #69672

mo-moneyy opened this issue May 22, 2020 · 4 comments
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.

Comments

@mo-moneyy
Copy link

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
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/var/www/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]
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.

- name: Download vars
      azure_rm_storageblob:
        resource_group: <resource group>
        storage_account_name: <storage account name>
        container: <container>
        blob: <blob>
        dest: /path/to/ex.yml
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"}


@mo-moneyy
Copy link
Author

The os I am using is Ubuntu 18.04

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. labels May 22, 2020
@Akasurde
Copy link
Member

@tigerkeeper5 Thanks for this issue. Azure modules are migrated to Ansible Azure Collection. Could you please migrate this issue to https://github.com/ansible-collections/azure/issues/new/choose? Thanks.

@Akasurde Akasurde added support:community This issue/PR relates to code supported by the Ansible community. and removed needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels May 23, 2020
@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed support:community This issue/PR relates to code supported by the Ansible community. labels May 23, 2020
@Akasurde
Copy link
Member

!component =lib/ansible/modules/cloud/azure/azure_rm_storageblob.py

@ansibot ansibot added azure cloud collection Related to Ansible Collections work collection:azure.azcollection collection:gavinfish.azureblob collection:gavinfish.azuretest module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels May 23, 2020
@mkrizek
Copy link
Contributor

mkrizek commented May 25, 2020

Closing in favor of ansible-collections/azure#130.

If you have further questions please stop by IRC or the mailing list:

@mkrizek mkrizek closed this as completed May 25, 2020
@ansible ansible locked and limited conversation to collaborators Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

No branches or pull requests

4 participants