blob: 6d5ba4b814b822a25b836e81063e368cfbea4199 [file] [log] [blame]
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +02001# -*- mode: ruby -*-
2# -*- coding: utf-8 -*-
3
Pawel Wieczoreke377eb02019-07-15 18:10:02 +02004host_ip = "192.168.121.1"
5
Pawel Wieczorek961b6442019-07-15 18:24:32 +02006rancher_port = 8080
7
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +02008vm_memory = 2 * 1024
9vm_cpus = 1
Pawel Wieczorek961b6442019-07-15 18:24:32 +020010vm_box = "generic/ubuntu1604"
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +020011
12cluster = [
13 { name: 'master', hostname: 'master', ip: '172.17.0.100' },
14 { name: 'worker', hostname: 'worker', ip: '172.17.0.101' }
15]
16
17Vagrant.configure('2') do |config|
18 cluster.each do |node|
19 config.vm.define node[:name] do |config|
Pawel Wieczorek961b6442019-07-15 18:24:32 +020020 config.vm.box = vm_box
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +020021 config.vm.hostname = node[:hostname]
22
23 config.vm.provider :virtualbox do |v|
24 v.name = node[:name]
25 v.memory = vm_memory
26 v.cpus = vm_cpus
27 end
28
29 config.vm.provider :libvirt do |v|
30 v.memory = vm_memory
31 v.cpus = vm_cpus
32 end
33
34 config.vm.network :private_network, ip: node[:ip]
Pawel Wieczoreke377eb02019-07-15 18:10:02 +020035 config.vm.provision :shell, inline: "echo nameserver #{host_ip} | resolvconf -a eth0.inet"
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +020036
37 if node[:name] == 'master'
Pawel Wieczorek961b6442019-07-15 18:24:32 +020038 config.vm.network "forwarded_port", guest: rancher_port, host: rancher_port
Pawel Wieczorek6bbff982019-07-14 17:04:53 +020039 config.vm.provision :shell, path: "../../tools/casablanca/imported/openstack-rancher.sh"
40 config.vm.provision :shell, path: "../../tools/casablanca/get_ranchercli.sh"
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +020041 end
42
43 if node[:name] == 'worker'
Pawel Wieczorek6bbff982019-07-14 17:04:53 +020044 config.vm.provision :shell, path: "../../tools/casablanca/imported/openstack-k8s-node.sh"
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +020045 end
46 end
47 end
48end