[deploy] Explicitly set NS for resolvconf in VMs 85/68285/2
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 29 Jul 2019 15:27:13 +0000 (17:27 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 29 Jul 2019 16:12:14 +0000 (18:12 +0200)
With newer Ubuntu distros using netplan and systemd-resolve, we
can't rely on /etc/resolv.conf found on the Jumphost being usable
inside the guest VMs, so explicitly use the public network DNS
servers configured in PDF/IDF.

This will enable support for Jumpserver operating systems like Ubuntu
18.04.

Change-Id: I0c7e02d5c1b822f809ce818e739c19d0344f39f5
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
mcp/scripts/lib_jump_deploy.sh
mcp/scripts/xdf_data.sh.j2

index 24fc4ee..532508a 100644 (file)
@@ -154,7 +154,7 @@ function __mount_image {
   if [[ "${MCP_OS:-}" =~ ubuntu1804 ]]; then
     # Ubuntu Bionic (18.04) or newer defaults to using netplan.io, revert it
     sudo mkdir -p "${OPNFV_MNT_DIR}/run/systemd/resolve"
-    sudo cp -f --remove-destination /etc/resolv.conf \
+    echo "nameserver ${dns_public}" | sudo tee \
       "${OPNFV_MNT_DIR}/run/systemd/resolve/stub-resolv.conf"
     sudo chroot "${OPNFV_MNT_DIR}" systemctl stop \
       systemd-networkd.socket systemd-networkd \
@@ -172,8 +172,9 @@ function __mount_image {
     sudo sed -i -e 's/^\(SELINUX\)=.*$/\1=permissive/g' \
       "${OPNFV_MNT_DIR}/etc/selinux/config"
   fi
-  sudo cp -f --remove-destination \
-    /etc/resolv.conf "${OPNFV_MNT_DIR}/etc/resolv.conf"
+  sudo rm -f "${OPNFV_MNT_DIR}/etc/resolv.conf"
+  echo "nameserver ${dns_public}" | sudo tee \
+    "${OPNFV_MNT_DIR}/etc/resolv.conf"
   echo "GRUB_DISABLE_OS_PROBER=true" | \
     sudo tee -a "${OPNFV_MNT_DIR}/etc/default/grub"
   sudo sed -i -e 's/^\(GRUB_TIMEOUT\)=.*$/\1=1/g' -e 's/^GRUB_HIDDEN.*$//g' \
index 032b00a..79bc16c 100644 (file)
@@ -100,6 +100,7 @@ OPNFV_BRIDGES=(
 )
 
 export CLUSTER_DOMAIN={{ conf.cluster.domain }}
+dns_public={{ nm.dns_public[0] }}
 cluster_states={{ bash_arr(arch.default.cluster.states + cluster_states) }}
 virtual_nodes={{ filter_nodes('virtual') }}
 control_nodes_query={{ filter_nodes(['baremetal', 'virtual'], True, ['control']) }}