Reputation: 6120
Is it possible to create an azure storage file share using Ansible ?
There is an Ansible module to create Azure Storage Account, so I am good there.
I dont see anything for File Share.
There is something called azure_rm_resource
but I have not been able to get it to work with it.
Any input will be appreciated.
Upvotes: 0
Views: 896
Reputation: 6120
Posting my answer as it will help someone in the community:
The latest commit contains this enhancement !
Copying the example from the link above :
- name: Create storage share
azure_rm_storageshare:
name: testShare
resource_group: myResourceGroup
account_name: testStorageAccount
state: present
access_tier: Cool
quota: 2048
metadata:
key1: value1
key2: value2
Upvotes: 1
Reputation: 1099
If you need custom implementation, I would suggest to use Azure CLI for developing a custom script, and then run it in your Ansible playbook.
E.g. reference fileshare.ps1
script with content of az storage share create --account-name MyAccount --name MyFileShare
...etc.
Documentation: https://learn.microsoft.com/en-us/cli/azure/storage/share?view=azure-cli-latest#az_storage_share_create
Edit: this solution only creates the storage account as of now, so it is not sufficient in most scenarios.
There is an Ansible module for this, already implemented, called azure_rm_storageaccount
in the azure
namespace. See the link in the bottom.
Make sure to use the kind
property and specify FileStorage
value. Example:
- name: Create an account with kind of FileStorage
azure_rm_storageaccount:
resource_group: souser_resource_group
name: souser_file_storage
type: Premium_LRS
kind: FileStorage
tags:
testing: testing
Documentation: https://docs.ansible.com/ansible/latest/collections/azure/azcollection/azure_rm_storageaccount_module.html
Upvotes: 1