Grab the ubuntu release version from VMs

Grab the ubuntu release version from VMs, then feed the VMs with
right sources.list file.

Change-Id: Iaf89716af1248676fbf2b735dd705a285e6cdf8b
This commit is contained in:
Weezer Su 2017-01-30 21:53:43 -06:00 committed by Amy Marrich (spotz)
parent e96b57d8d6
commit 0bf6407914
2 changed files with 5 additions and 2 deletions

View File

@ -54,6 +54,9 @@ for i in $(apt-key list | awk '/pub/ {print $2}' | awk -F'/' '{print $2}'); do
apt-key export "$i" > "/tmp/keys/$i" apt-key export "$i" > "/tmp/keys/$i"
done done
# Get the ubuntu release version from VMs.
RELEASE_VERSION=`ssh -q -o StrictHostKeyChecking=no 10.0.0.100 "lsb_release -sr"`
# Ensure that all running VMs have an updated apt-cache with keys # Ensure that all running VMs have an updated apt-cache with keys
for node in $(get_all_hosts); do for node in $(get_all_hosts); do
ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mkdir -p /tmp/keys" ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mkdir -p /tmp/keys"
@ -62,7 +65,7 @@ for node in $(get_all_hosts); do
scp "$i" "10.0.0.${node#*":"}:$i" scp "$i" "10.0.0.${node#*":"}:$i"
fi fi
done done
if [[ "14.04" != "$(lsb_release -sr)" ]]; then if [[ "14.04" != "${RELEASE_VERSION:0:5}" ]]; then
ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mv /tmp/sources.list /etc/apt/sources.list" ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mv /tmp/sources.list /etc/apt/sources.list"
fi fi
ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "(for i in /tmp/keys/*; do \ ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "(for i in /tmp/keys/*; do \

View File

@ -60,7 +60,7 @@ chown www-data /var/lib/cobbler/webui_sessions
# when templated replace \$ with $ # when templated replace \$ with $
cp -v templates/dhcp.template /etc/cobbler/dhcp.template cp -v templates/dhcp.template /etc/cobbler/dhcp.template
# Create a trusty sources file # Create a sources.list file
if [[ "14.04.4" == $DEFAULT_IMAGE ]]; then if [[ "14.04.4" == $DEFAULT_IMAGE ]]; then
cp -v templates/trusty-sources.list /var/www/html/trusty-sources.list cp -v templates/trusty-sources.list /var/www/html/trusty-sources.list
else else