使用“ azure_rm_deployment”时,资源组是在特定位置“我们西部”上创建的吗?

时间:2019-04-15 14:10:23

标签: ansible

使用“ azure_rm_deployment”时,资源组仅在美国西部位置创建。我如何在其他任何位置创建它。 另外,当尝试在印度中部创建的资源组中创建资源时出现错误 资源组create_or_update失败,状态码为409,消息:无效的资源组位置“ westus”。资源组已经存在于“ centralindia”位置。“}

这是我的代码

- name: Create Azure Deploy
  azure_rm_deployment:
    state: present
    resource_group_name: "myresources" //manualy created in location central india
    parameters:
       location:
          value: Central India
    template:
      $schema: "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"
      contentVersion: "1.0.0.0"
      location: "[variables('location')]"
      deployment-name: "mypx"
      resources:
        - type: "Microsoft.Network/virtualNetworks"
          apiVersion: "2015-05-01-preview"
          name: "[variables('virtualNetworkName')]"
          location: "[parameters('location')]"
          properties:
            addressSpace:
              addressPrefixes:
                - "[variables('addressPrefix')]"
            subnets:
              - name: "[variables('subnetName')]"
                properties:
                  addressPrefix: "[variables('subnetPrefix')]"

1 个答案:

答案 0 :(得分:0)

请参见Ansible documentation of the azure_rm_deployment module:该模块具有一个location参数供您使用。

所以您的任务将以此开始:

- name: Create Azure Deploy
  azure_rm_deployment:
    state: present
    resource_group_name: "myresources" //manualy created in location central india
    location: your-desired-location

,此块可以省略:

    parameters:
       location:
          value: Central India