With this script, you can add Slave DNS zones at ClouDNS with PowerDNS Master server and MySQL database. You can download it from here.
AUTH_ID should be your API user ID AUTH_PASS should be the password of your API user.
MASTER_IP is the IP address of your PowerDNS Master server.
MASTER_IP2 is the second IP address of your PowerDNS server (optional).
PDNS_MYSQL_HOST is the IP address of your MySQL server.
PDNS_MYSQL_USER is your MySQL database username.
PDNS_MYSQL_PASS is your MySQL database password.
PDNS_MYSQL_DB is your database name in MySQL.
PDNS_MYSQL_PORT is the listening port of your MySQL server port.
TMPFILE is the temp file which will contain a list of zones which are already added or checked with the HTTP API.
// Auth ID and Password
define("AUTH_ID", 0);
define("AUTH_PASS", "xxx");
// IP address of the master server (primary server)
define("MASTER_IP", "xxx.xxx.xxx.xxx");
// Second IP address for master server (it may be IPv6 or IPv4 address)
//define("MASTER_IP2", "xxx.xxx.xxx.xxx");
// PowerDNS MySQL configuration
define("PDNS_MYSQL_HOST", "xxx.xxx.xxx.xxx");
define("PDNS_MYSQL_USER", "xxx");
define("PDNS_MYSQL_PASS", "xxx");
define("PDNS_MYSQL_DB", "xxx");
define("PDNS_MYSQL_PORT", "5432");
// this file will contain a list of zones, which are already added or checked with the HTTP API
define("TMPFILE", "/tmp/cloudns_checked_zones.txt");
When you are ready with your configuration, you can run the script with the following command:
php powerdns-mysql-slave-zones-add.php
The script will output a list with Slave DNS zones created at ClouDNS.
If your API user ID or Password are incorrect, you will get an error message.
If the MySQL details and credentials are incorrect, you will get an error message.
You can add this script to be executed each first day from the month. Example:
0 0 1 * * /usr/bin/php /path/to/php powerdns-mysql-slave-zones-add.php