You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.9 KiB
Ruby

#
# Author: Hari Sekhon
# Date: 2020-08-14 13:16:04 +0100 (Fri, 14 Aug 2020)
# (forked from private repo from 2013)
# Original Date: 2013-03-18 16:38:04 +0000 (Mon, 18 Mar 2013)
#
# vim:ts=4:sts=4:sw=4:et:filetype=ruby
#
# https://github.com/harisekhon/bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you"re using my code you"re welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# https://www.vagrantup.com/docs/vagrantfile
Vagrant.configure("2") do |config|
# https://www.vagrantup.com/docs/boxes
#
# to get Hashicorp"s Ubuntu 18.04 base box:
#
# vagrant init hashicorp/bionic64
#
# or try one of the Bento boxes:
#
# https://app.vagrantup.com/bento
#
#config.vm.box = "hashicorp/bionic64"
config.vm.box = "bento/ubuntu-18.04"
# root login doesn't work on hashicorp/bionic64 or bento/ubuntu-18.04 box with pw 'vagrant'
#config.ssh.username = "root"
#config.ssh.password = "vagrant"
config.ssh.insert_key = true
#config.ssh.private_key_path = "~/.ssh/id_rsa"
# host_path guest_path
config.vm.synced_folder "~/github", "/github"
config.vm.synced_folder "../../", "/bash"
config.ssh.forward_agent = false
config.ssh.forward_x11 = false
config.vm.usable_port_range = 2250..2299
#config.vm.boot_mode = "gui"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
#vb.name = "default-vagrant-hostname" # overridden per VM
vb.customize [
"modifyvm", :id,
"--name", "#{vb.name}",
"--natdnsproxy1", "on",
"--usb", "off",
"--audio", "none"
]
# using the host's DNS is simple but less portable as it requires an extra step of adding the nodes to the host's /etc/hosts file, which is an easy step to miss, so just inject the hosts files in each VM instead
#"--natdnshostresolver1", "on",
# evaluates too early and gets 'default-vagrant-hostname'
#config.vm.hostname = "#{vb.name}"
end
# generic provision for each VM
config.vm.provision :shell, :path => "../provision.sh"
config.vm.define "ubuntu" do |config|
config.vm.network "private_network", ip: "172.16.0.2"
config.vm.provider "virtualbox" do |vb|
# can't set vb.name at shared level, as it evaluates too early and gets 'default-vagrant-hostname'
vb.name = "unbuntu"
vb.cpus = 1
vb.memory = 1024 # edit to suit your needs
vb.customize [
"modifyvm", :id, "--name", "#{vb.name}"
]
# sets the guest OS hostname and /etc/hosts (edited by provision.sh as we want external IP and not 127.0.1.1)
config.vm.hostname = "#{vb.name}"
end
end
end