Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
| 4 | vm_memory = 2 * 1024 |
| 5 | vm_cpus = 1 |
| 6 | |
| 7 | cluster = [ |
| 8 | { name: 'master', hostname: 'master', ip: '172.17.0.100' }, |
| 9 | { name: 'worker', hostname: 'worker', ip: '172.17.0.101' } |
| 10 | ] |
| 11 | |
Pawel Wieczorek | 7b2c82b | 2019-06-27 17:38:53 +0200 | [diff] [blame^] | 12 | ranchercli = <<-SCRIPT |
| 13 | wget https://releases.rancher.com/cli/v0.6.12/rancher-linux-amd64-v0.6.12.tar.gz |
| 14 | tar xf rancher-linux-amd64-v0.6.12.tar.gz |
| 15 | sudo mv rancher-v0.6.12/rancher /usr/local/bin/ |
| 16 | rmdir rancher-v0.6.12/ |
| 17 | rm rancher-linux-amd64-v0.6.12.tar.gz |
| 18 | SCRIPT |
| 19 | |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 20 | Vagrant.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 Wieczorek | 7b2c82b | 2019-06-27 17:38:53 +0200 | [diff] [blame^] | 42 | config.vm.provision :shell, inline: ranchercli |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 43 | 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 |
| 50 | end |