diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-07-13 13:02:07 +0200 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-07-13 13:10:53 +0200 |
commit | c017090d8b4869591746f75b0aa000a3e1a5bb07 (patch) | |
tree | a4068a8cfe2b76761fd51fdab011d073ff65b535 /bootstrap/codesearch/Vagrantfile | |
parent | 1663d8cbb03f7986772ee5089dd4692352860987 (diff) |
[CODESEARCH] Rework the nameserver provisioning
Default OS resolver is set using native systemd-resolved
facilities in a way that it will be persisted after box
reload.
Default nameserver is set within Vagrantfile and can be altered
if needed.
Vagrant-libvirt specific resolver settings were removed in favor
of a general one. As of now it should be possible to also run this
box using Virtualbox provider.
Change-Id: Icdd1eb8bf3677c4616b1ac7d6b3387e0f4c7535a
Issue-ID: INT-1940
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'bootstrap/codesearch/Vagrantfile')
-rw-r--r-- | bootstrap/codesearch/Vagrantfile | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bootstrap/codesearch/Vagrantfile b/bootstrap/codesearch/Vagrantfile index 4c77309c9..3df687a96 100644 --- a/bootstrap/codesearch/Vagrantfile +++ b/bootstrap/codesearch/Vagrantfile @@ -1,23 +1,25 @@ # -*- mode: ruby -*- # -*- coding: utf-8 -*- -host_ip = "192.168.121.1" +nameserver = "8.8.8.8" synced_folder = "/vagrant" houndd_bin = "${HOME}/go/bin/houndd" houndd_config = "${HOME}/config.json" onap_git = "git.onap.org" $replace_dns = <<-SCRIPT - HOST_IP="$1" - rm -f /etc/resolv.conf # drop its dynamic management by systemd-resolved - echo nameserver "$HOST_IP" | tee /etc/resolv.conf + ns="$1" + # persist resolver settings + sed -i "s/addresses:.*/addresses: [${ns}]/" /etc/netplan/01-netcfg.yaml + # setup resolver for current boot session + resolvectl dns eth0 ${ns} SCRIPT Vagrant.configure("2") do |config| config.vm.box = "generic/ubuntu2004" config.vm.synced_folder ".", synced_folder, type: "rsync", rsync__exclude: "Vagrantfile" config.vm.network "forwarded_port", guest: 6080, host: 6080 - config.vm.provision "replace_dns", type: :shell, run: "always", inline: $replace_dns, args: host_ip + config.vm.provision "replace_dns", type: :shell, inline: $replace_dns, args: nameserver config.vm.provision "dependencies", type: :shell, inline: <<-SHELL export DEBIAN_FRONTEND=noninteractive apt-get update |