-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
62 lines (56 loc) · 1.96 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
61
62
###
### Push action requires: socat, screen
###
$box_name_server = "ubuntu/xenial64"
#$box_name_client = "q2p/empty"
$box_name_client = "package.box"
$server_ip = "192.168.2.2"
$client_socet = '/tmp/pxe_client_vm-socket'
$client_pty = '/tmp/pxe_client_vm-pty'
Vagrant.configure(2) do |config|
config.vm.define "server", autostart: true do |server|
server.vm.box = $box_name_server
server.vm.hostname = "pxe-server"
server.vm.network "private_network", ip: $server_ip, virtualbox__intnet: "pxe_network"
server.vm.synced_folder "vagrant-volume/", "/vagrant-volume/"
server.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
ansible.extra_vars = { 'pxe_env': "#{ENV['pxe_env'] || "dev"}" }
end
server.vm.provider :virtualbox do |vb|
vb.memory = '1024'
vb.cpus = '1'
end
end
config.vm.define "client", autostart: true do |client|
client.ssh.insert_key = "false"
client.vm.boot_timeout = 1
client.vm.post_up_message = "Probably machine is unreachable by ssh. It's expected."
client.vm.box = $box_name_client
client.vm.provider :virtualbox do |vb|
vb.memory = '2048'
vb.cpus = '2'
vb.gui = 'true'
vb.customize [
'modifyvm', :id,
'--nic1', 'intnet',
'--intnet1', 'pxe_network',
'--boot1', 'disk',
'--boot2', 'net',
'--boot3', 'none',
'--boot4', 'none',
'--uart1', '0x3F8', '4',
'--uartmode1', 'server', $client_socet
]
end
end
config.push.define "local-exec" do |push|
push.inline = <<-SCRIPT
clear
socat UNIX-CONNECT:#{$client_socet} PTY,link=#{$client_pty} &
echo "Ctrl+A Ctrl+D for detach"
sleep 1
screen #{$client_pty}
SCRIPT
end
end