-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
executable file
·56 lines (47 loc) · 1.8 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- mode: ruby -*-
# vi: set ft=ruby :
$VAGRANT_EXTRA_STEPS = <<~SCRIPT
git config --global --add safe.directory '*'
echo "cd /vagrant" >> /home/vagrant/.bashrc
SCRIPT
$SET_NETWORK = <<~'SCRIPT'
IFNAME=$(ifconfig | grep -B1 10.0.1. | grep -o "^\w*")
echo "export IFNAME=$IFNAME" >> /home/vagrant/.bashrc
sudo echo "export IFNAME=$IFNAME" >> /root/.bashrc
sudo tcset $IFNAME --rate 100Mbps --delay 20ms
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' \
/etc/ssh/sshd_config
sudo service sshd restart
SCRIPT
Vagrant.configure(2) do |config|
config.ssh.forward_agent = true
config.vm.synced_folder "project-2_15-441", "/vagrant/project-2_15-441"
config.vm.provision "shell",
inline: "sudo /vagrant/project-2_15-441/setup/setup.sh"
config.vm.provision "shell", inline: $VAGRANT_EXTRA_STEPS
config.ssh.insert_key = false
config.vm.provider "docker" do |docker, override|
override.vm.box = nil
docker.image = "rofrano/vagrant-provider:ubuntu-22.04"
docker.remains_running = true
docker.has_ssh = true
docker.privileged = true
docker.create_args = ["--cgroupns=host"]
docker.volumes = ["/sys/fs/cgroup:/sys/fs/cgroup:rw"]
end
config.vm.provider "virtualbox" do |v, override|
override.vm.box = "ubuntu/jammy64"
end
config.vm.define :client, primary: true do |host|
host.vm.hostname = "client"
host.vm.network "private_network", ip: "10.0.1.2", netmask: 8,
mac: "080027a7feb1", virtualbox__intnet: "15441"
host.vm.provision "shell", inline: $SET_NETWORK
end
config.vm.define :server do |host|
host.vm.hostname = "server"
host.vm.network "private_network", ip: "10.0.1.1", netmask: 8,
mac: "08002722471c", virtualbox__intnet: "15441"
host.vm.provision "shell", inline: $SET_NETWORK
end
end