azure - 我可以使用 Ansible 创建 Azure 文件共享吗?

标签 azure ansible

是否可以使用 Ansible 创建 Azure 存储文件共享?
有一个 Ansible 模块可以创建 Azure 存储帐户,所以我很擅长。
我没有看到文件共享的任何内容。
有一个名为 azure_rm_resource 的东西,但我无法让它使用它。
任何意见将不胜感激。

最佳答案

自定义脚本解决方案

如果您需要自定义实现,我建议使用 Azure CLI 开发自定义脚本,然后在 Ansible playbook 中运行它。

例如引用 fileshare.ps1 脚本,其内容为 az storage share create --account-name MyAccount --name MyFileShare ...等

文档:https://learn.microsoft.com/en-us/cli/azure/storage/share?view=azure-cli-latest#az_storage_share_create

使用 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

文档: https://docs.ansible.com/ansible/latest/collections/azure/azcollection/azure_rm_storageaccount_module.html

关于azure - 我可以使用 Ansible 创建 Azure 文件共享吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70399631/

相关文章:

kubernetes - Ansible 错误 : "[Errno 2] No such file or directory"

如果文件存在,则 Ansible 停止剧本

Ansible:在剧本中,按标签过滤角色,而无需在命令行中传递

windows - Ansible:检测证书是否已安装在证书存储中的最佳方法

azure - 自动创建 SQL .bak 或 .bacpac 备份文件并将其保存到 Azure 云存储容器的最佳方法是什么?

windows - 如何查找 Windows Azure 的应计账单费用

azure - 仅列出容器中的 blob/文件,而不列出目录、子目录、子文件

azure - Azure 是否监视应用服务的所有实例?

azure - 来自 Microsoft Oauth 端点的 Guzzle 400 错误请求

ansible - 在ansible中检查文件的真实性