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

How to use azure_rm_storageblob to perform batch delete? #968

Closed
beepdot opened this issue Sep 7, 2022 · 1 comment
Closed

How to use azure_rm_storageblob to perform batch delete? #968

beepdot opened this issue Sep 7, 2022 · 1 comment

Comments

@beepdot
Copy link

beepdot commented Sep 7, 2022

SUMMARY

How can we use azure_rm_storageblob to perform batch delete? I have a folder which has a bunch of files. I would like to delete all files from this folder.

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

azure_rm_storageblob

ANSIBLE VERSION
ansible --version
ansible 2.10.17
  config file = /Users/keshavprasad/Repos/keshavprasadms/sunbird-devops-public/ansible/ansible.cfg
  configured module search path = ['/Users/keshavprasad/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ansible
  executable location = /Library/Frameworks/Python.framework/Versions/3.10/bin/ansible
  python version = 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)]

Using azcopy, I can do the same something like this

azcopy rm "https://STORAGE_ACCPINT/CONTAINER/FOLDER?SAS_TOKEN" --recursive=true

I would like to achieve this using the ansible modules. I tried patterns like * and **, it didn't work. Any suggestions on how to achieve batch delete? Example playbook below -

- hosts: localhost
  environment:
    AZURE_TENANT: "tenant_id"
    AZURE_SUBSCRIPTION_ID: "subscription_id"
    AZURE_CLIENT_ID: "client_id"
    AZURE_SECRET: "client_secret"
  tasks:
  - name: Delete Blob
    azure_rm_storageblob:
      resource_group: "my-rg"
      storage_account_name: "my-storage"
      container: "my-container"
      blob: "my-folder/*"
      state: absent
      blob_type: block

I am open to any suggestions of there is another way to do the same.

@Fred-sun
Copy link
Collaborator

duplicate with #967 , and fixes in #833

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants