Skip to content

Add support for variant zones #178

@fpicot

Description

@fpicot

PowerDNS 5.0 has added support for variant zones and views : https://doc.powerdns.com/authoritative/views.html

It doesn't seem possible to create such a zone using ansible-powerdns-auth.

With the following task:

    - name: Declare Public Authoritative zones
      kpfleming.powerdns_auth.zone:
        api_key: "{{ pdns_auth_apikey }}"
        name: "example.com..variant1"
        properties:
          kind: "Master"
          nameservers:
            - "ns1.example.com."
            - "ns2.example.com."
          soa:
            mname: "ns1.example.com."
            rname: "dnsmaster.example.com."
        state: present

I get the error :
API operation createZone returned 'DNS Name 'example.com..variant1' is not canonical'

This seems to be because the 'name' property of the task is used as the record name for SOA instead of the canonical zone name.

This can be reproduced with curl :

# Broken example
curl -v -X POST \
        -H "X-API-Key: xxxx" \
        -H "Content-Type: application/json" \
        -d '{"name": "example.com..variant1", "kind": "Native", "masters": [], "rrsets": [{"name": "example.com..variant1", "type": "SOA", "ttl": 3600, "records": [{"content": "ns1.example.com. dnsmaster.example.com. 1 86400 7200 3600000 172800", "disabled": false}]}]}' \
        http://127.0.0.1:8081/api/v1/servers/localhost/zones
[...]
< HTTP/1.1 422 Unprocessable Entity
[...]
{"error": "DNS Name 'example.com..variant1' is not canonical"}


# Working example
curl -v -X POST \
        -H "X-API-Key: xxxx" \
        -H "Content-Type: application/json" \
        -d '{"name": "example.com..variant1", "kind": "Native", "masters": [], "rrsets": [{"name": "example.com.", "type": "SOA", "ttl": 3600, "records": [{"content": "ns1.example.com. dnsmaster.example.com. 1 86400 7200 3600000 172800", "disabled": false}]}]}' \
        http://127.0.0.1:8081/api/v1/servers/localhost/zones
[...]
< HTTP/1.1 201 Created
[...]
{"account": "", "api_rectify": false, "catalog": "", "dnssec": false, "edited_serial": 2026022501, "id": "example.com..variant1", "kind": "Native", "last_check": 0, "master_tsig_key_ids": [], "masters": [], "name": "example.com..variant1", "notified_serial": 0, "nsec3narrow": false, "nsec3param": "", "rrsets": [{"comments": [], "name": "example.com.", "records": [{"content": "ns1.example.com. dnsmaster.example.com. 2026022501 86400 7200 3600000 172800", "disabled": false, "modified_at": 1772036622}], "ttl": 3600, "type": "SOA"}], "serial": 2026022501, "slave_tsig_key_ids": [], "soa_edit": "", "soa_edit_api": "DEFAULT", "url": "/api/v1/servers/localhost/zones/example.com..variant1"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions