Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
| 4 | host_ip = "192.168.121.1" |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 5 | synced_folder = "/vagrant" |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 6 | |
| 7 | $replace_dns = <<-SCRIPT |
| 8 | HOST_IP="$1" |
| 9 | rm -f /etc/resolv.conf # drop its dynamic management by systemd-resolved |
| 10 | echo nameserver "$HOST_IP" | tee /etc/resolv.conf |
| 11 | SCRIPT |
| 12 | |
| 13 | Vagrant.configure("2") do |config| |
| 14 | config.vm.box = "generic/ubuntu1804" |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 15 | config.vm.synced_folder ".", synced_folder, type: "rsync", rsync__exclude: "Vagrantfile" |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 16 | config.vm.provision "replace_dns", type: :shell, run: "always", inline: $replace_dns, args: host_ip |
| 17 | config.vm.provision "dependencies", type: :shell, inline: <<-SHELL |
| 18 | export DEBIAN_FRONTEND=noninteractive |
| 19 | apt-get update |
| 20 | apt-get install --assume-yes --quiet golang |
| 21 | SHELL |
| 22 | config.vm.provision "binaries", type: :shell, privileged: false, inline: <<-SHELL |
| 23 | export GOPATH="${HOME}/go" |
| 24 | go get -u github.com/hound-search/hound/cmds/... |
| 25 | SHELL |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 26 | config.vm.provision "generate_config", type: :shell, privileged: false, inline: <<-SHELL |
| 27 | python3 #{synced_folder}/create_config.py |
| 28 | SHELL |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 29 | end |