-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
37 lines (31 loc) · 1007 Bytes
/
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
Vagrant.configure("2") do |config|
if Vagrant.has_plugin?("vagrant-env")
config.env.load('.env.local', '.env')
end
# required
VPN_GATEWAY = default_s('VPN_GATEWAY', '')
VPN_PROTOCOL = default_s('VPN_PROTOCOL', '')
VPN_USER = default_s('VPN_USER', '')
VPN_PASSWORD = default_s('VPN_PASSWORD', '')
# optional
VPN_SOCKS_PORT = default_i('VPN_SOCKS_PORT', 1080)
end
def default_s(key, default)
ENV[key] && ! ENV[key].empty? ? ENV[key] : default
end
def default_i(key, default)
default_s(key, default).to_i
end
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-20.04"
config.vm.network "forwarded_port", guest: 1080, host: VPN_SOCKS_PORT
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
ansible.extra_vars = {
vpn_gateway: VPN_GATEWAY,
vpn_protocol: VPN_PROTOCOL,
vpn_user: VPN_USER,
vpn_password: VPN_PASSWORD
}
end
end