是否可以使用 Ansible 创建 Azure 存储文件共享?
有一个 Ansible 模块可以创建 Azure 存储帐户,所以我很擅长。
我没有看到文件共享的任何内容。
有一个名为 azure_rm_resource
的东西,但我无法让它使用它。
任何意见将不胜感激。
最佳答案
自定义脚本解决方案
如果您需要自定义实现,我建议使用 Azure CLI 开发自定义脚本,然后在 Ansible playbook 中运行它。
例如引用 fileshare.ps1
脚本,其内容为 az storage share create --account-name MyAccount --name MyFileShare
...等
使用 Ansible 模块的简单解决方案(编辑:目前还不够)
编辑:此解决方案目前仅创建存储帐户,因此在大多数情况下还不够。
在 azure
命名空间中,有一个已实现的 Ansible 模块,名为 azure_rm_storageaccount
。请参阅底部的链接。
确保使用 kind
属性并指定 FileStorage
值。示例:
- 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
关于azure - 我可以使用 Ansible 创建 Azure 文件共享吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70399631/