-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
86 lines (75 loc) · 2.57 KB
/
Vagrantfile
File metadata and controls
86 lines (75 loc) · 2.57 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def gui?
!ENV.fetch('GUI', '').empty?
end
VAGRANT_COMMAND = ARGV[0]
Vagrant.configure("2") do |config|
# global vars
timezone = "Asia/Manila"
project = File.basename(__dir__)
if VAGRANT_COMMAND == "ssh"
config.ssh.username = "chu"
end
# vmware
config.vm.provider "vmware_desktop" do |v|
v.ssh_info_public = true
v.allowlist_verified = true
end
# https://github.com/devopsgroup-io/vagrant-hostmanager
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = true
config.hostmanager.include_offline = true
config.vm.provision :shell, inline: 'echo $(hostname) is up'
# alpine
config.vm.define "alpine" do |h|
h.vm.box = "freepaddler/alpine"
h.vm.hostname = "#{project}-alpine"
h.vm.provider "vmware_desktop" do |v|
v.memory = 512
v.cpus = 2
v.gui = gui?
end
h.vm.synced_folder ".", "/vagrant", disabled: "true"
h.vm.provision "timezone", type: "shell", run: "once",
inline: "setup-timezone #{timezone}"
end
# centos
config.vm.define "centos" do |h|
h.vm.box = "freepaddler/centos9"
h.vm.hostname = "#{project}-centos"
h.vm.provider "vmware_desktop" do |v|
v.memory = 512
v.cpus = 2
end
h.vm.synced_folder ".", "/vagrant", disabled: "true"
h.vm.provision "timezone", type: "shell", run: "once",
inline: "timedatectl set-timezone #{timezone}"
end
config.vm.define "debian" do |h|
h.vm.box = "freepaddler/debian"
h.vm.hostname = "#{project}-debian"
h.vm.provider "vmware_desktop" do |v|
v.memory = 512
v.cpus = 2
end
h.vm.synced_folder ".", "/vagrant", disabled: "true"
h.vm.provision "timezone", type: "shell", run: "once",
inline: "timedatectl set-timezone #{timezone}"
end
config.vm.define "freebsd" do |h|
h.vm.box = "freepaddler/freebsd"
h.vm.hostname = "#{project}-freebsd"
h.vm.provider "vmware_desktop" do |v|
v.memory = 512
v.cpus = 2
end
# define, but disable to avoid warnings
h.vm.synced_folder ".", "/vagrant", disabled: "true"
h.vm.provision "timezone", type: "shell", run: "once",
inline: <<-SHELL
cp "/usr/share/zoneinfo/#{timezone}" /etc/localtime
sysrc timezone="#{timezone}"
SHELL
end
end