Adds in option to modify DNS - removes hardcoded values

Some networks may not allow 8.8.8.8 Google DNS servers. This patch
allows this to be specified in the variables file or to pull the value
from the systems resolv.conf file.

Change-Id: I494ab82c41bcd59ea85404d49cb2696029353a0e
This commit is contained in:
Rick Box 2017-02-20 12:36:01 +00:00
parent 1b40ea4cf3
commit 3baca05501
4 changed files with 13 additions and 4 deletions

View File

@ -59,7 +59,7 @@ neutron subnet-create GATEWAY_NET ${NETWORK_BASE}.248.0/22 \
--name GATEWAY_NET_SUBNET \
--gateway ${NETWORK_BASE}.248.1 \
--allocation-pool start=${NETWORK_BASE}.248.201,end=${NETWORK_BASE}.248.255 \
--dns-nameservers list=true 8.8.4.4 8.8.8.8
--dns-nameservers list=true ${DNS_NAMESERVER}
# Neutron private network setup
neutron net-create PRIVATE_NET \

View File

@ -17,6 +17,9 @@ set -eu
# Load all functions
source functions.rc
# bring in variable definitions if there is a variables.sh file
[[ -f variables.sh ]] && source variables.sh
# The default image for VMs, change it to 16.04 if you want to use xenial as operation system.
DEFAULT_IMAGE="${DEFAULT_IMAGE:-"$(lsb_release -sd | awk '{print $2}')"}"
@ -58,7 +61,9 @@ mkdir_check "/tftpboot"
chown www-data /var/lib/cobbler/webui_sessions
# when templated replace \$ with $
# Copy dhcp template and replace with DNS var
cp -v templates/dhcp.template /etc/cobbler/dhcp.template
sed -i "s|__DNS_NAMESERVER__|${DNS_NAMESERVER}|g" /etc/cobbler/dhcp.template
# Create a sources.list file
if [[ $DEFAULT_IMAGE == "14.04."* ]]; then
@ -155,7 +160,7 @@ for node_type in $(get_all_types); do
--ip-address="10.0.0.${node#*":"}" \
--subnet=255.255.255.0 \
--gateway=10.0.0.200 \
--name-servers=8.8.8.8 8.8.4.4 \
--name-servers="${DNS_NAMESERVER}" \
--static=1
done
done

View File

@ -20,7 +20,7 @@ option pxe-system-type code 93 = unsigned integer 16;
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.200;
option domain-name-servers 8.8.8.8;
option domain-name-servers __DNS_NAMESERVER__;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.0.0.1 10.0.0.50;
default-lease-time 21600;
@ -82,4 +82,4 @@ group {
}
#end for
}
#end for
#end for

View File

@ -1,2 +1,6 @@
# Variables used by multi-node-aio
# Network subnet used for all the virtual machines
NETWORK_BASE=172.29
# DNS used throughout the deploy
#DNS_NAMESERVER=$(cat /etc/resolv.conf | grep -m 1 "nameserver" | sed "s/nameserver //")
DNS_NAMESERVER=8.8.8.8