forked from paulczar/docker-percona_galera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
66 lines (51 loc) · 2.45 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
# -*- mode: ruby -*-
# # vi: set ft=ruby :
require 'fileutils'
require_relative 'factorish.rb'
Vagrant.configure('2') do |config|
config.vm.box = "coreos-#{$coreos_channel}"
config.vm.box_version = ">= #{$min_coreos_version}"
config.vm.box_url = "http://storage.core-os.net/coreos/amd64-usr/#{$coreos_channel}/coreos_production_vagrant.json"
config.vm.provider :vmware_fusion do |_, override|
override.vm.box_url = "http://storage.core-os.net/coreos/amd64-usr/#{$coreos_channel}/coreos_production_vagrant_vmware_fusion.json"
end
# plugin conflict
config.vbguest.auto_update = false if Vagrant.has_plugin?('vagrant-vbguest')
(1..$num_instances).each do |i|
config.vm.define vm_name = format('core-%02d', i) do |c|
c.vm.hostname = vm_name
if $enable_serial_logging
logdir = File.join(File.dirname(__FILE__), 'log')
FileUtils.mkdir_p(logdir)
serial_file = File.join(logdir, format('%s-serial.txt', vm_name))
FileUtils.touch(serial_file)
c.vm.provider :vmware_fusion do |v, _|
v.vmx['serial0.present'] = 'TRUE'
v.vmx['serial0.fileType'] = 'file'
v.vmx['serial0.fileName'] = serialFile
v.vmx['serial0.tryNoRxLoss'] = 'FALSE'
end
c.vm.provider :virtualbox do |vb, _|
vb.customize ['modifyvm', :id, '--uart1', '0x3F8', '4']
vb.customize ['modifyvm', :id, '--uartmode1', serialFile]
end
end
c.vm.network 'forwarded_port', guest: $expose_docker_tcp, host: $expose_docker_tcp, auto_correct: true if $expose_docker_tcp
c.vm.network 'forwarded_port', guest: $expose_etcd_tcp, host: $expose_etcd_tcp, auto_correct: true if $expose_etcd_tcp
c.vm.provider :virtualbox do |vb|
vb.gui = $vb_gui
vb.memory = $vb_memory
vb.cpus = $vb_cpus
end
ip = "172.17.8.#{i + 100}"
c.vm.network :private_network, ip: ip
c.vm.synced_folder '.', '/home/core/share', id: 'core', nfs: true, mount_options: ['nolock,vers=3,udp']
c.vm.provision "shell", inline: "echo noop > /sys/block/sda/queue/scheduler"
if File.exist?("./user-data-#{i}")
c.vm.provision :file, source: "./user-data-#{i}", destination: '/tmp/vagrantfile-user-data'
c.vm.provision :shell, inline: 'mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/', privileged: true
end
c.vm.provision :shell, inline: 'echo use systemctl and journalctl to view progress of startup'
end
end
end