This repository has been archived by the owner on Jul 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVagrantfile
92 lines (79 loc) · 2.63 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Vagrant.configure('2') do |c|
c.vm.box = 'debian/buster64'
c.ssh.forward_agent = true
Dir.mkdir('tmp') unless File.exist?('tmp')
if File.exist?('tmp/ethernet-device.txt')
bridge = File.read('tmp/ethernet-device.txt').chomp
else
if RbConfig::CONFIG['host_os'] =~ /mswin32|mingw32/
bridge = 'Ethernet'
else
bridge = 'eth0'
end
File.write('tmp/ethernet-device.txt', bridge + "\n")
end
if File.exist?('tmp/hostname.txt')
hostname = File.read('tmp/hostname.txt').chomp
else
# TODO: Make this work on Windows.
hostname = `. configuration/project.sh && echo "${PROJECT_NAME_INITIALS}"`
hostname = hostname.chomp
File.write('tmp/hostname.txt', hostname + "\n")
end
if File.exist?('tmp/domain.txt')
domain = File.read('tmp/domain.txt').chomp
else
# TODO: Make this work on Windows.
domain = `hostname -f`
domain = domain.chomp
File.write('tmp/domain.txt', domain + "\n")
end
c.vm.network :public_network, bridge: bridge
c.vm.network :private_network, ip: '192.168.42.3'
c.vm.synced_folder '.', '/vagrant', type: 'nfs'
c.vm.provider :virtualbox do |v|
v.name = 'jenkins-tools'
v.cpus = 2
v.memory = 2048
v.customize ['modifyvm', :id, '--vram', '12']
end
c.vm.provision :shell, path: 'script/vagrant/update-system.sh'
c.vm.provision :shell, path: 'script/vagrant/provision.sh'
unless RbConfig::CONFIG['host_os'] =~ /mswin32|mingw32/
c.vm.provision :ansible do |a|
a.playbook = 'playbook.yaml'
a.compatibility_mode = '2.0'
a.extra_vars = {
'java': {
'headless': true,
'development': false,
'version': 11
},
'jenkins': {
'enabled': true,
'admin': {
'password': 'admin'
}
}
}
# Allow remote_user: root.
a.force_remote_user = false
# Uncomment for more verbosity.
#a.verbose = true
#a.verbose = 'vv'
#a.verbose = 'vvv'
end
end
c.vm.synced_folder 'salt-provisioning', '/srv/salt', type: 'nfs'
c.vm.provision :shell do |s|
s.path = 'script/vagrant/salt.sh'
s.args = [hostname + '.' + domain, '/vagrant/tmp/salt/minion.conf']
# Install upstream Salt package.
#s.path = 'tmp/bootstrap-salt.sh'
# Jessie versions: https://repo.saltstack.com/apt/debian/8/amd64
# Stretch versions: https://repo.saltstack.com/apt/debian/9/amd64
# Buster versions: http://repo.saltstack.com/py3/debian/10/amd64
#s.args = ['-U', '-i', hostname + '.' + domain, '-c', '/vagrant/tmp/salt', 'stable', '2018.3.3']
end
c.vm.provision :shell, inline: 'salt-call state.highstate'
end