-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexport_dns2ipa.sh
More file actions
executable file
·58 lines (44 loc) · 1.18 KB
/
export_dns2ipa.sh
File metadata and controls
executable file
·58 lines (44 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
# AUTHOR: Oleg Brodkin
#
# DATE: Oct-1-2012
#
# DESCRIPTION: to migrate cobbler DNS to freeIPA DNS
#
# PRE-REQUISIT: DNS master file *.zone
#
# INPUT:
#
# OUTPUT: IPA commands for replicating DNS entries
#
# RELEASE NOTE:
# 1.0
#
source ./pinglib_inc.sh
readonly DNSMASTER="/var/named/masters/cgtanalytics.com.zone"
readonly MAINDOMAIN="cgtanalytics.com"
echo "#=== Exporting A Records"
grep "IN A" $DNSMASTER | awk '{print $1," ",$4 }' | while read host ip
do
if [ "X"${host:0:2} == "XIN" ] || [ ${host:0:1} == ";" ]
then
continue
fi
echo -en "\n#-- "$host "\t ["$ip"] --"
# if ping fails, echo OFFLINE
onlineStatus ${ip}
echo -e "\n ipa dnsrecord-add "${MAINDOMAIN}" "${host}" --a-rec "${ip}" --a-create-reverse; wait"
done
echo "#=== Exporting CNAME Records"
grep "IN CNAME" $DNSMASTER | awk '{print $1," ",$4 }' | while read cname host
do
echo -en "\n#-- "$cname "\t" $host" --"
if [ "X"${host:(-1)} == "X." ]
then
onlineStatus ${host}
else
onlineStatus ${host}"."${MAINDOMAIN}
fi
echo -e "\n ipa dnsrecord-add "${MAINDOMAIN}" "${cname}" --cname-rec "${host}"; wait"
done