-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstart.sh
28 lines (20 loc) · 843 Bytes
/
start.sh
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
#!/bin/bash
hfn=/etc/dnsmasq.d/hosts
# Generate /etc/dnsmasq.d/ configuration for additional hosts
# DOMAIN= openshift host zone
# HOSTNAMES= CSV of openshift host names (not fqdn, will automatically append DOMAIN)
# <HOSTNAME>_IP= case sensitive env var for the IP of each host
# WILDCARD= wildcard zone
# WILDCARD_IP= ip of wildcard zone
# Start from scratch with the hostnames - casual attempt at making this idempotent
rm -f ${hfn}
hosts=$(echo $HOSTNAMES | tr "," "\n")
for HOST in $hosts
do
fqdn=$HOST.$DOMAIN
eval ip='$'$HOST'_IP'
echo "host-record=$HOST.$DOMAIN,$ip" >> ${hfn}
done
cat ${hfn}
echo "/usr/sbin/dnsmasq -d --local=/$DOMAIN/ --address=/$WILDCARD/$WILDCARD_IP --conf-dir=/etc/dnsmasq.d"
/usr/sbin/dnsmasq -d --local-service --local=/$DOMAIN/ --address=/$WILDCARD/$WILDCARD_IP --conf-dir=/etc/dnsmasq.d