-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
64 lines (57 loc) · 3.09 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
63
64
# to make sure the nodes are created in order we
# have to force a --no-parallel execution.
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
suffix = 'vpn.example.com'
config_moon_fqdn = "moon.#{suffix}"
config_moon_ip = '192.168.0.10'
config_moon_internal_ip = '10.1.0.2'
config_moon_ubuntu_fqdn = "moon-ubuntu.#{config_moon_fqdn}"
config_moon_ubuntu_ip = '10.1.0.4'
config_sun_fqdn = "sun.#{suffix}"
config_sun_ip = '192.168.0.20'
config_sun_internal_ip = '10.2.0.2'
config_sun_ubuntu_fqdn = "sun-ubuntu.#{config_sun_fqdn}"
config_sun_ubuntu_ip = '10.2.0.4'
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu-22.04-amd64'
config.vm.provider :libvirt do |lv, config|
lv.memory = 1024
lv.cpus = 2
lv.cpu_mode = 'host-passthrough'
# lv.nested = true
lv.keymap = 'pt'
lv.disk_driver :discard => 'unmap', :cache => 'unsafe'
config.vm.synced_folder '.', '/vagrant', type: 'nfs', nfs_version: '4.2', nfs_udp: false
end
config.vm.define 'moon' do |config|
config.vm.hostname = config_moon_fqdn
config.vm.network :private_network, ip: config_moon_ip, libvirt__forward_mode: 'route', libvirt__dhcp_enabled: false
config.vm.network :private_network, ip: config_moon_internal_ip, netmask: '255.255.0.0', libvirt__forward_mode: 'route', libvirt__dhcp_enabled: false
config.vm.provision :shell, inline: "echo '#{config_moon_ip} #{config_moon_fqdn}' >>/etc/hosts"
config.vm.provision :shell, inline: "echo '#{config_sun_ip} #{config_sun_fqdn}' >>/etc/hosts"
config.vm.provision :shell, path: 'provision-common.sh'
config.vm.provision :shell, path: 'provision-certificates.sh'
config.vm.provision :shell, path: 'provision-vpn-device.sh'
end
config.vm.define 'sun' do |config|
config.vm.hostname = config_sun_fqdn
config.vm.network :private_network, ip: config_sun_ip, libvirt__forward_mode: 'route', libvirt__dhcp_enabled: false
config.vm.network :private_network, ip: config_sun_internal_ip, netmask: '255.255.0.0', libvirt__forward_mode: 'route', libvirt__dhcp_enabled: false
config.vm.provision :shell, inline: "echo '#{config_moon_ip} #{config_moon_fqdn}' >>/etc/hosts"
config.vm.provision :shell, inline: "echo '#{config_sun_ip} #{config_sun_fqdn}' >>/etc/hosts"
config.vm.provision :shell, path: 'provision-common.sh'
config.vm.provision :shell, path: 'provision-vpn-device.sh'
end
config.vm.define 'moon-ubuntu' do |config|
config.vm.hostname = config_moon_ubuntu_fqdn
config.vm.network :private_network, ip: config_moon_ubuntu_ip, netmask: '255.255.0.0', libvirt__forward_mode: 'route', libvirt__dhcp_enabled: false
config.vm.provision :shell, path: 'provision-common.sh'
config.vm.provision :shell, path: 'provision-ubuntu.sh'
end
config.vm.define 'sun-ubuntu' do |config|
config.vm.hostname = config_sun_ubuntu_fqdn
config.vm.network :private_network, ip: config_sun_ubuntu_ip, netmask: '255.255.0.0', libvirt__forward_mode: 'route', libvirt__dhcp_enabled: false
config.vm.provision :shell, path: 'provision-common.sh'
config.vm.provision :shell, path: 'provision-ubuntu.sh'
end
end