gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 05:23:43 24 4
gpt4 key购买 nike

是否可以使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com