Replace a Designate Node
Problem
One or more hosts authorized with the Designate role need to be decommissioned, shutdown, or otherwise replaced.
If this has already occurred, one or more zones and their respective recordsets may be showing in either PENDING or ERROR state, depending on how long it's been.
Environment
Platform9 Managed OpenStack - All Versions
Designate
Procedure
Identify the IP address of your BIND server, and also of the Designate host(s) which are to remain or otherwise replace the old hosts.
Create a file update-masters.awk on the BIND server and populate it with the following content, modifying the bolded variables as per the legend below.
BEGIN {
SERVER_IP = "<BIND_IP>"
KEY = ""
MASTERS = "<DESIGNATE_NODE_1_IP> port 5354; <DESIGNATE_NODE_2_IP> port 5354;"
RNDC_ADD_CMD = "rndc -s %s addzone %s '%s'<br>"
RNDC_DEL_CMD = "rndc -s %s delzone %s<br>"
}
/^zone/ {
# Remove quotes from zone name
gsub("\"", "", $2)
zone_name = $2
# Iterate over remaining fields. Concatenate into 'zone_data'.
zone_data = ""
for(i=3; i<=NF; i++){
zone_data=zone_data" "$i
}
sub("^ ", "", zone_data)
# Find configured DNS servers
match(zone_data, /( ?([0-9]+.){4}( port [0-9]+);){1,}/, master_servers)
sub("^ ", "", master_servers[0])
# If configured masters do not match desired masters
if (master_servers[0] != MASTERS){
sub(master_servers[0], MASTERS, zone_data)
# Print command to delete zones
printf RNDC_DEL_CMD, SERVER_IP, zone_name
# Print command to add zones
printf RNDC_ADD_CMD, SERVER_IP, zone_name, zone_data
}
}
END {}SERVER_IP = IP on which the BIND server is listening.
MASTERS = IP(s) of the aforementioned Designate host(s) which will remain to be online and become the active masters.
Execute the awk script and pipe the stdout to update_zones.sh.
Set the proper permissions and execute the resulting update_zones.sh script.
Last updated
