blob: c0cbb9889359d712b3f199e2d58a5a905299da32 [file] [log] [blame]
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +02001# -*- mode: ruby -*-
2# -*- coding: utf-8 -*-
3
4vm_memory = 2 * 1024
5vm_cpus = 1
6
7cluster = [
8 { name: 'master', hostname: 'master', ip: '172.17.0.100' },
9 { name: 'worker', hostname: 'worker', ip: '172.17.0.101' }
10]
11
Pawel Wieczorek7b2c82b2019-06-27 17:38:53 +020012ranchercli = <<-SCRIPT
13wget https://releases.rancher.com/cli/v0.6.12/rancher-linux-amd64-v0.6.12.tar.gz
14tar xf rancher-linux-amd64-v0.6.12.tar.gz
15sudo mv rancher-v0.6.12/rancher /usr/local/bin/
16rmdir rancher-v0.6.12/
17rm rancher-linux-amd64-v0.6.12.tar.gz
18SCRIPT
19
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +020020Vagrant.configure('2') do |config|
21 cluster.each do |node|
22 config.vm.define node[:name] do |config|
23 config.vm.box = "generic/ubuntu1604"
24 config.vm.hostname = node[:hostname]
25
26 config.vm.provider :virtualbox do |v|
27 v.name = node[:name]
28 v.memory = vm_memory
29 v.cpus = vm_cpus
30 end
31
32 config.vm.provider :libvirt do |v|
33 v.memory = vm_memory
34 v.cpus = vm_cpus
35 end
36
37 config.vm.network :private_network, ip: node[:ip]
38
39 if node[:name] == 'master'
40 config.vm.network "forwarded_port", guest: 8080, host: 8080
41 config.vm.provision :shell, path: "../tools/imported/openstack-rancher.sh"
Pawel Wieczorek7b2c82b2019-06-27 17:38:53 +020042 config.vm.provision :shell, inline: ranchercli
Pawel Wieczorekea8bc1a2019-06-27 16:46:28 +020043 end
44
45 if node[:name] == 'worker'
46 config.vm.provision :shell, path: "../tools/imported/openstack-k8s-node.sh"
47 end
48 end
49 end
50end