-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
60 lines (50 loc) · 1.91 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
57
58
59
60
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This is a Vagrantfile example that can be used to serve firmwares to some
# routers from TP-Link family (e.g.: TL-WDR3600 or TL-WR841ND) right after they
# being hard reset (also known as 30/30/30 procedure). It uses tftpd as a Docker
# container to serve files placed under '/vagrant/tftpboot' directory from Host system.
ENV["LC_ALL"] = "en_US.UTF-8"
def configure_machine(config:, cpus:, memory:, ip_address:, netmask_bits:, hostname:, name:)
config.vm.box = "bento/ubuntu-16.04"
config.vm.boot_timeout = 360
config.vm.hostname = hostname
config.vm.network "public_network", use_dhcp_assigned_default_route: true, ip: ip_address
config.vm.provision "shell", inline: "ip address flush dev eth1 && ip address add #{ip_address}/#{netmask_bits} dev eth1", preserve_order: true, run: "always"
config.vm.provider "virtualbox"
config.ssh.shell = "bash"
config.vm.provision "shell", path: "bin/provision.sh", preserve_order: true, run: "once"
config.vm.provision "shell", path: "bin/docker-run.sh", preserve_order: true, run: "always"
config.vm.provider :virtualbox do |vbx|
vbx.name = name
vbx.gui = true
vbx.linked_clone = true
vbx.memory = memory
vbx.cpus = cpus
vbx.customize ["modifyvm", :id, "--ioapic", "on"]
end
end
Vagrant.configure("2") do |config|
config.vm.define "tftpd-server" do |tftpd_server|
configure_machine(
config: tftpd_server,
cpus: 1,
memory: 256,
ip_address: "192.168.10.100",
netmask_bits: "16",
hostname: "tftpd-server",
name: "tftpd - Default Server"
)
end
config.vm.define "tplink-unbricker", autostart: false do |tplink_unbricker|
configure_machine(
config: tplink_unbricker,
cpus: 1,
memory: 256,
ip_address: "192.168.0.66",
netmask_bits: "16",
hostname: "tplink-unbricker",
name: "tftpd - TP-Link Unbricker"
)
end
end