-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVagrantfile.libvirt
34 lines (27 loc) · 1.12 KB
/
Vagrantfile.libvirt
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
# -*- mode: ruby -*-
# vi: set ft=ruby
require 'yaml'
servers = YAML.load_file(File.join(File.dirname(__FILE__), 'config/servers.yaml'))
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu1804'
config.trigger.before :up do |trigger|
trigger.name = "Removing stale kube-join.sh"
trigger.info = "A stale kube-join.sh will prevent the nodes from joining the master"
trigger.run = {inline: "bash -c 'if [ -f config/kube-join.sh ]; then rm -f config/kube-join.sh; fi'"}
end
servers['vagrant'].each do |name, server_config|
config.vm.define name do |host|
config.vm.synced_folder '.', '/vagrant', type: 'sshfs'
host.vm.hostname = name
host.vm.network :private_network, ip: server_config['vm']['ip']
end
if server_config.has_key?('provider') then
server_config['provider'].each do |provider_config_key, provider_config_value|
config.vm.provider :libvirt do |host|
host.send("#{provider_config_key.to_sym}=", "#{provider_config_value}")
end
end
end
end
config.vm.provision :shell, path: 'config/bootstrap-kube.sh', :privileged => true
end