Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
Pawel Wieczorek | e377eb0 | 2019-07-15 18:10:02 +0200 | [diff] [blame] | 4 | host_ip = "192.168.121.1" |
| 5 | |
Pawel Wieczorek | 961b644 | 2019-07-15 18:24:32 +0200 | [diff] [blame] | 6 | rancher_port = 8080 |
| 7 | |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 8 | vm_memory = 2 * 1024 |
| 9 | vm_cpus = 1 |
Pawel Wieczorek | 961b644 | 2019-07-15 18:24:32 +0200 | [diff] [blame] | 10 | vm_box = "generic/ubuntu1604" |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 11 | |
| 12 | cluster = [ |
Pawel Wieczorek | 1554174 | 2019-09-30 14:23:30 +0200 | [diff] [blame] | 13 | { name: 'master', hostname: 'master', ip: '172.17.3.100' }, |
| 14 | { name: 'worker', hostname: 'worker', ip: '172.17.3.101' } |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 15 | ] |
| 16 | |
| 17 | Vagrant.configure('2') do |config| |
| 18 | cluster.each do |node| |
| 19 | config.vm.define node[:name] do |config| |
Pawel Wieczorek | 961b644 | 2019-07-15 18:24:32 +0200 | [diff] [blame] | 20 | config.vm.box = vm_box |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 21 | 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 Wieczorek | e377eb0 | 2019-07-15 18:10:02 +0200 | [diff] [blame] | 35 | config.vm.provision :shell, inline: "echo nameserver #{host_ip} | resolvconf -a eth0.inet" |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 36 | |
| 37 | if node[:name] == 'master' |
Pawel Wieczorek | 961b644 | 2019-07-15 18:24:32 +0200 | [diff] [blame] | 38 | config.vm.network "forwarded_port", guest: rancher_port, host: rancher_port |
Pawel Wieczorek | 6bbff98 | 2019-07-14 17:04:53 +0200 | [diff] [blame] | 39 | config.vm.provision :shell, path: "../../tools/casablanca/imported/openstack-rancher.sh" |
| 40 | config.vm.provision :shell, path: "../../tools/casablanca/get_ranchercli.sh" |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 41 | end |
| 42 | |
| 43 | if node[:name] == 'worker' |
Pawel Wieczorek | 6bbff98 | 2019-07-14 17:04:53 +0200 | [diff] [blame] | 44 | config.vm.provision :shell, path: "../../tools/casablanca/imported/openstack-k8s-node.sh" |
Pawel Wieczorek | ea8bc1a | 2019-06-27 16:46:28 +0200 | [diff] [blame] | 45 | end |
| 46 | end |
| 47 | end |
| 48 | end |