doc_noob
doc_noob

Reputation: 625

Upload to azure file share using ansible without mounting

I have an azure storage account in which i have a azure file share. Right now i am mounting it in a server and uploading the files there, is there a way in ansible that can extract and upload files directly to azure share instead of mounting that in a server and then doing the same? I have searched that in azure_rm_storageaccount, but could not get any idea other than mounting. Any help on this would be appreciated.

Upvotes: 1

Views: 1746

Answers (1)

Charles Xu
Charles Xu

Reputation: 31424

Unfortunately, it's impossible to upload the files directly through the module that Ansible provided. The special module does not exist currently. So you need to think out another way to achieve it through the Ansible.

For example, you can use the Azure CLI command azure storage file upload to upload the files to the Azure File Storage:

az storage file upload --account-key 00000000 --account-name MyStorageAccount --path path/file.txt --share-name MyShare --source /path/to/file

And then you can put this command in the ansible with shell module like this:

tasks:
  - name: Get all the access keys
    shell: aws iam list-access-keys --user-name {{ username }} --query 'AccessKeyMetadata[*].AccessKeyId'

Upvotes: 2

Related Questions