Re: [Pdns-users] Adding multiple records to all zones at once
> Why not do something along the lines of (PostgreSQL syntax as that's > what I know, and completely untested): > > INSERT INTO records (domain_id, name, type, content, ttl) >SELECT domain.id, 'autoconfig.' || domains.name, 'CNAME, ' zone>, 3600 >FROM domains >JOIN records ON domains.id = records.domain_id >WHERE domains.id NOT IN ( >SELECT domains_id FROM records >JOIN domains ON domains.id = records.domain_id >WHERE name = 'autoconfig.' || domains.name ); > > You may want to just run the SELECT first to see that it gives you what > you want. When you insert records directly into the DB, the zone may be broken (NSEC, NSEC3 ordername, empty non-terminal RRs ...). Therefore you have to call "rectify" for every zone that was changed and PowerDNS will check and if necessary fix the zone. regards Klaus ___ Pdns-users mailing list Pdns-users@mailman.powerdns.com https://mailman.powerdns.com/mailman/listinfo/pdns-users
Re: [Pdns-users] Adding multiple records to all zones at once
Andrea Biancalani via Pdns-users writes: > 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","","3600"); > insert into records(domain_id,name,type,content,ttl) VALUES > ("2","autodiscover.zonename.tld","CNAME","","3600"); Why not do something along the lines of (PostgreSQL syntax as that's what I know, and completely untested): INSERT INTO records (domain_id, name, type, content, ttl) SELECT domain.id, 'autoconfig.' || domains.name, 'CNAME, ', 3600 FROM domains JOIN records ON domains.id = records.domain_id WHERE domains.id NOT IN ( SELECT domains_id FROM records JOIN domains ON domains.id = records.domain_id WHERE name = 'autoconfig.' || domains.name ); You may want to just run the SELECT first to see that it gives you what you want. Best regards, Jacob ___ Pdns-users mailing list Pdns-users@mailman.powerdns.com https://mailman.powerdns.com/mailman/listinfo/pdns-users
[Pdns-users] Adding multiple records to all zones at once
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","/**/","3600"); insert into records(domain_id,name,type,content,ttl) VALUES ("*2*","autodiscover.*zonename.tld*","CNAME","/**/","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. ___ Pdns-users mailing list Pdns-users@mailman.powerdns.com https://mailman.powerdns.com/mailman/listinfo/pdns-users