[Pdns-users] Adding multiple records to all zones at once

Andrea Biancalani a.biancalani at conmet.it
Wed Oct 4 16:42:18 UTC 2023


Hello there,

I'm using latest PDNS server authoritative with MySQL backend and I want 
to autoadd 2 records (autodiscover/autoconfig CNAMEs) for each zone 
available in my db (that has not those records already set), to make it 
more clear:

Example.

    *zone1.tld*

        autodiscover.zone1.tld    CNAME autodiscover.outlook.com    3600
        autoconfig.zones1.tld    CNAME autoconfig.outlook.com    3600

    *zone2.tld*

        none


    *zone3.tld*

        none


    *zone4.tld*

        autodiscover.zone4.tld    CNAME autodiscover.outlook.com    3600
        autoconfig.zones4.tld    CNAME autoconfig.outlook.com    3600


    *zone5.tld*

        autodiscover.zone5.tld    CNAME autodiscover.outlook.com    3600
        autoconfig.zones5.tld    CNAME autoconfig.outlook.com    3600

Using powerdns db in a mysql shell I can prompt this command

    insert into records(domain_id,name,type,content,ttl) VALUES
    ("*2*","autoconfig.*zonename.tld*","CNAME","/*<my autoconfig
    zone>*/","3600");
    insert into records(domain_id,name,type,content,ttl) VALUES
    ("*2*","autodiscover.*zonename.tld*","CNAME","/*<my autodiscover
    zone>*/","3600");


but I need to extract all my zones within a script, than use a script to 
extract only null zone IDs, than push values inside db: not so practical.

Is there any way to avoid this and push those values inside not 
overwriting existing values (where already set)?

After this I'll schedule a "pdnsutil increase-serial" loop to increase 
SOA serials and propagate those differences to slaves with AXFR.

Any help is more than welcome!

Thanks all.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20231004/02558f85/attachment.htm>


More information about the Pdns-users mailing list