简体   繁体   English

Ansible:更新 Azure 中的私有 DNS 区域时出现“unknown type long”

[英]Ansible: "unknown type long" when updating Private DNS Zone in Azure

I try to update serial number for a zone in Private DNS in Azure.我尝试更新 Azure 私有 DNS 中某个区域的序列号。 To do that, I run Ansible code:为此,我运行 Ansible 代码:

- name: Increment DNS serial
  azure_rm_dnsrecordset:
    resource_group: "{{ my_rg }}"
    zone_name: "{{ my_domain }}"
    relative_name: "@"
    record_type: "SOA"
    records:
      - serial_number: "{{ new_serial }}"
  register: dns_update
  until: dns_update is succeeded      

Ansible however fails with type mismatch error:但是 Ansible 因类型不匹配错误而失败:

The full traceback is:
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            ...
            "record_mode": "purge",
            "record_type": "SOA",
            "records": [
                {
                    "serial_number": "2"
                }
            ],
            "relative_name": "@",
            "resource_group": "my-rg",
            "state": "present",
            ...
        }
    },
    "msg": "implementation error: unknown type long requested for serial_number"
}

The error message is a bit confusing: should I understand it as Ansible trying to send 2 as long while Azure API expects string, or vice versa, Azure expects long but Ansible sends string?错误消息有点令人困惑:我是否应该将其理解为 Ansible 尝试发送 2,而 Azure API 需要字符串,反之亦然,Azure 需要很长但 Ansible 发送字符串?

Which type conversion should I apply?我应该应用哪种类型转换?

Except above issue, is this proper way to update serial?除了上述问题,这是更新串行的正确方法吗?

I bypassed this by switching from azure_rm_dnsrecordset Ansible module to az call, replacing the template as below:我通过从 azure_rm_dnsrecordset Ansible 模块切换到 az 调用来绕过这个,替换模板如下:

- name: Increment DNS serial
  command: >
    az network private-dns record-set soa update
    --resource-group "{{ my_rg }}"
    --zone-name "{{ my_domain }}"
    --serial-number "{{ new_serial }}"

This is accepted by Azure at least.这至少被 Azure 接受。

It does not update serial for me however.但是,它不会为我更新序列号。 I can update other SOA paramters like refresh time or minimum TTL, but not the serial number;我可以更新其他 SOA 参数,例如刷新时间或最小 TTL,但不能更新序列号; but this is different issue.但这是不同的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure 私人 DNS 区域查询 - PowerShell - Azure Private DNS Zone Query - PowerShell Azure 专用链接 - DNS 区域设置 - Azure Private Link - DNS Zone Setup 什么是 Azure 私有 DNS 区域组? - What is Azure Private DNS Zone Group? 是否有必要为 Azure 中的 PaaS 服务的私有端点创建私有 DNS 区域? - Is it necessary to create a private DNS zone for private endpoints to PaaS services in Azure? 无法通过点到站点 VPN 连接将私有 dns 区域解析为 Azure - Not resolving private dns zone over point to site VPN connection into Azure 如何使用私有 dns 区域,当我们从 azure 中的客户端 vm 访问我们的网站时将使用该区域。如何为客户端虚拟配置 dns 区域 - How to use private dns zone which will be used when we access our website from our client vm in azure.How to configure dns zone for client virtual 为 Azure 容器注册表 (ACR) 的私有终结点创建动态私有 dns 区域记录 - Creating dynamic private dns zone records for private endpoints of Azure Container Registry (ACR) Azure DNS 区域标签问题 - Azure DNS Zone tags issue Azure dns 区域 vnet 集成 - Azure dns zone vnet integration Azurescaleset专用DNS - Azure scaleset private DNS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM