我尝试使用Ansible为存储帐户部署私有端点。我正在使用azure.azcollection.azure_rm_privateendpoint。我的剧本代码如下:
- name: Create PE
hosts: localhost
connection: local
tasks:
- name: create_pe
azure.azcollection.azure_rm_privateendpoint:
name: testprivateendpoint
resource_group: MYRG
private_link_service_connections:
- name: pe-satest
group_ids: blob
private_link_service_id: /subscriptions/xxxxxxxxx/resourceGroups/MYRG/providers/Microsoft.Storage/storageAccounts/mysa
subnet:
id: /subscriptions/xxxxxxx/resourceGroups/MYRG-VNET/providers/Microsoft.Network/virtualNetworks/MYVNET/subnets/mySubnet
启动ansible playbook命令后,出现以下错误:
TASK [create_pe] ****************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error creating or updating private endpoint testprivateendpoint - 'NetworkManagementClient' object has no attribute 'private_endpoints'"}
PLAY RECAP **********************************************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
你知道这个错误的来源吗
此错误
"msg": "Error creating or updating private endpoint testprivateendpoint - 'NetworkManagementClient' object has no attribute 'private_endpoints'"
是由NetworkManagementClient
无法获取private_endpoints
引起的您可以尝试添加以下代码来解决此问题:
创建
azure_rm_privateendpoint.py
并将其包含在您的剧本中,例如main.yml
。您可以参考How to run a python script from a ansible playbook、Running Python script via ansible和Running custom python script using ansible script module你可以参考azure_rm_privateendpoint_info.py、azure_rm_privateendpoint.py和Azure rm privateendpoint
如果仍然出现相同的错误,可以在GitHub上打开一个问题:ansible-collections/azure
相关问题 更多 >
编程相关推荐