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 | |
| 12 | Vagrant.configure('2') do |config| |
| 13 | cluster.each do |node| |
| 14 | config.vm.define node[:name] do |config| |
| 15 | config.vm.box = "generic/ubuntu1604" |
| 16 | config.vm.hostname = node[:hostname] |
| 17 | |
| 18 | config.vm.provider :virtualbox do |v| |
| 19 | v.name = node[:name] |
| 20 | v.memory = vm_memory |
| 21 | v.cpus = vm_cpus |
| 22 | end |
| 23 | |
| 24 | config.vm.provider :libvirt do |v| |
| 25 | v.memory = vm_memory |
| 26 | v.cpus = vm_cpus |
| 27 | end |
| 28 | |
| 29 | config.vm.network :private_network, ip: node[:ip] |
| 30 | |
| 31 | if node[:name] == 'master' |
| 32 | config.vm.network "forwarded_port", guest: 8080, host: 8080 |
| 33 | config.vm.provision :shell, path: "../tools/imported/openstack-rancher.sh" |
| 34 | end |
| 35 | |
| 36 | if node[:name] == 'worker' |
| 37 | config.vm.provision :shell, path: "../tools/imported/openstack-k8s-node.sh" |
| 38 | end |
| 39 | end |
| 40 | end |
| 41 | end |