$ORIGIN ocp1.example.com.
@ 3600 IN SOA example.com. example.com. (
2017042745 ; serial
7200 ; refresh (2 hours)
3600 ; retry (1 hour)
1209600 ; expire (2 weeks)
3600 ; minimum (1 hour)
)
3600 IN NS ns.example.com.
api IN A 192.168.1.10
api-int IN A 192.168.1.10
*.apps IN A 192.168.1.10
bootstrap IN A 192.168.1.10
master1 IN A 192.168.1.20
master2 IN A 192.168.1.21
master3 IN A 192.168.1.22
worker1 IN A 192.168.1.30
worker2 IN A 192.168.1.31
worker3 IN A 192.168.1.32
#/bin/bashDNS_IP=127.0.0.1
declare-Aarr
arr[api.ocp1.example.com]=192.168.1.10
arr[api-int.ocp1.example.com]=192.168.1.10
arr[a.apps.ocp1.example.com]=192.168.1.10
arr[master1.ocp1.example.com]=192.168.1.20
arr[master2.ocp1.example.com]=192.168.1.21
arr[master3.ocp1.example.com]=192.168.1.22
arr[worker1.ocp1.example.com]=192.168.1.30
arr[worker2.ocp1.example.com]=192.168.1.31
arr[worker3.ocp1.example.com]=192.168.1.32
forkeyin"${!arr[@]}";doip=$(dig@$DNS_IP+short$key)if["$ip"!="${arr[$key]}"];thenecho"$key is ${arr[$key]}, result $ip"fidomain=$(dig@$DNS_IP+short-x${arr[$key]})if[[$key==a.*]];thencontinuefiif[[$key==api*]];thendomains=($domain)if[[!"${domains[*]}"=~"${key}"]];thenecho"${arr[$key]} is $key, result ${array[*]}"fielseif[[!"$domain"=="$key."]];thenecho"${arr[$key]} is $key, result $domain"fifidone