Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- mode: ruby -*-
- # vi: set ft=ruby :
- require "yaml"
- require "vagrant-openstack-provider"
- # Variable defaults (see below for overrides)
- $kube_version = "ubuntu/trusty64"
- $kube_memory = 512
- $kube_vcpus = 1
- $kube_count = 1
- # Use a variable file for overrides:
- CONFIG = File.expand_path("config.rb")
- if File.exist?(CONFIG)
- require CONFIG
- end
- # Force best practices for this environment:
- if $kube_memory < 512
- puts "WARNING: Your machine should have at least 512 MB of memory"
- end
- # Install any Required Plugins
- missing_plugins_installed = false
- required_plugins = %w(vagrant-env vagrant-openstack-provider)
- required_plugins.each do |plugin|
- if !Vagrant.has_plugin? plugin
- system "vagrant plugin install #{plugin}"
- missing_plugins_installed = true
- end
- end
- # If any plugins were missing and have been installed, re-run vagrant
- if missing_plugins_installed
- exec "vagrant #{ARGV.join(" ")}"
- end
- # Vagrantfile API/sytax version. Don’t touch unless you know what you’re doing!
- VAGRANTFILE_API_VERSION = "2"
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- # Required line, override with variables later
- config.ssh.username = "ubuntu"
- config.ssh.private_key_path = "~/.ssh/id_rsa"
- # Guest Definitions:
- # ------------------------
- #
- # START: Kube Definition(s)
- (1..$kube_count).each do |kb|
- config.vm.define vm_name = "kube#{kb}" do |kube|
- kube.vm.box = $kube_version
- kube.vm.hostname = "kube#{kb}"
- # NETWORK-SETTINGS: eth1 configured in the 192.168.236.0/24 network
- kube.vm.network "private_network", ip: "192.168.236.1#{kb}"
- kube.vm.network "forwarded_port", guest: 2368, host: "1236#{kb}", auto_correct: true
- # Openstack Provider (Optional --provider=openstack):
- kube.vm.provider "virtualbox" do |vb|
- vb.name = "kube#{kb}"
- vb.customize ["modifyvm", :id, "--memory", $kube_memory]
- vb.customize ["modifyvm", :id, "--cpus", $kube_vcpus]
- end
- # Openstack Provider (Optional --provider=openstack):
- kube.vm.provider "openstack" do |os|
- # Openstack Authentication Information:
- os.openstack_auth_url = $os_auth_url
- os.username = $os_username
- os.password = $os_password
- os.tenant_name = $os_tenant
- # Openstack Instance Information:
- os.server_name = "kube#{kb}"
- os.flavor = $os_flavor
- os.image = $os_image
- os.floating_ip_pool = $os_floatnet
- os.networks = $os_fixednet
- os.keypair_name = $os_keypair
- os.security_groups = $os_secgroups
- end
- end
- end
- # STOP: Kube Definition(s)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement