Skip to content
Snippets Groups Projects
Commit 9db5b725 authored by MJB's avatar MJB
Browse files

#38 fixed bugs in vagrantfile

parent 75326d04
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
require 'getoptlong' require 'getoptlong'
require 'yaml' require 'yaml'
# Custom options: # Custom options:
# --infra <infradir> # --infra <infradir>
...@@ -53,7 +52,6 @@ puts "custom config file: /infra/#{infra}/rspec.yml" ...@@ -53,7 +52,6 @@ puts "custom config file: /infra/#{infra}/rspec.yml"
host_rspec_file = "infra/#{infra}/rspec.yml" host_rspec_file = "infra/#{infra}/rspec.yml"
hosts = YAML.load_file(host_rspec_file) hosts = YAML.load_file(host_rspec_file)
# Start creating VMS using xenial64 as the base box # Start creating VMS using xenial64 as the base box
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64" config.vm.box = "ubuntu/xenial64"
...@@ -64,6 +62,7 @@ Vagrant.configure("2") do |config| ...@@ -64,6 +62,7 @@ Vagrant.configure("2") do |config|
#p host["name"] #p host["name"]
instance_name = host["name"] instance_name = host["name"]
config.vm.define instance_name do |instance_config| config.vm.define instance_name do |instance_config|
# Specify VM properties # Specify VM properties
instance_config.vm.hostname = instance_name instance_config.vm.hostname = instance_name
instance_config.disksize.size = host["disk"] instance_config.disksize.size = host["disk"]
...@@ -71,27 +70,34 @@ Vagrant.configure("2") do |config| ...@@ -71,27 +70,34 @@ Vagrant.configure("2") do |config|
v.customize ["modifyvm", :id, "--memory", host["memory"]] v.customize ["modifyvm", :id, "--memory", host["memory"]]
v.customize ["modifyvm", :id, "--cpus", host["cpus"]] v.customize ["modifyvm", :id, "--cpus", host["cpus"]]
end end
# Configure network
# Configure network, not that we only expect 1 test to be running so we have one internal network
config.vm.network :private_network, ip: "#{host["ip_address"]}", virtualbox__intnet: "clmc-net" config.vm.network :private_network, ip: "#{host["ip_address"]}", virtualbox__intnet: "clmc-net"
# Port forwarding # Port forwarding
puts "Forwarding the following specified ports for #{host["name"]}:" puts "Forwarding the following specified ports for #{host["name"]}:"
host['forward_ports'].each do |port| host['forward_ports'].each do |port|
puts "Forwarding guest:#{port["guest"]} => host:#{port["host"]}" puts "Forwarding guest:#{port["guest"]} => host:#{port["host"]}"
config.vm.network "forwarded_port", guest: port["guest"], host: port["host"] config.vm.network "forwarded_port", guest: port["guest"], host: port["host"]
end end
# Switch case added here to make clmc-service provisioning simple without having to have a complex rspec.yml file # Switch case added here to make clmc-service provisioning simple without having to have a complex rspec.yml file
# We only run a service installation script and the agent installation script when creating a specific service VM, not the clmc-service VM # We only run a service installation script and the agent installation script when creating a specific service VM, not the clmc-service VM
case host
puts "Instance name #{instance_name}:"
case instance_name
when 'clmc-service' when 'clmc-service'
config.vm.provision :shell, :path => "scripts/clmc-service/#{host["install_script"]}" config.vm.provision :shell, :path => "scripts/clmc-service/#{host["install_script"]}"
config.vm.provision :shell, :path => "scripts/clmc-service/#{host["start_script"]}" config.vm.provision :shell, :path => "scripts/clmc-service/#{host["start_script"]}"
when (not 'clmc-service') else
puts "Provisioning #{instance_name}:"
# specific service install # specific service install
service_install_path = "test/services/#{host["service_name"]}/install-#{host["service_name"]}.sh" service_install_path = "test/services/#{host["service_name"]}/install-#{host["service_name"]}.sh"
puts "installing service script: #{service_install_path}" puts "installing service script: #{service_install_path}"
config.vm.provision :shell, :path => service_install_path config.vm.provision :shell, :path => service_install_path
# agent install # agent install
config.vm.provision :shell, :path => "scripts/clmc-agent/install-clmc-agent.sh", :args => "/vagrant/test/services/#{host["service_name"]}/telegraf_#{host["service_name"]}_template.conf #{host["location"]} #{host["sfc_id"]} #{host["sfc_id_instance"]} #{host["sf_id"]} #{host["sf_id_instance"]} #{host["ipendpoint_id"]} #{host["influxdb_url"]} #{host["database_name"]}" config.vm.provision :shell, :path => "scripts/clmc-agent/install-clmc-agent.sh", :args => "/vagrant/test/services/#{host["service_name"]}/telegraf_#{host["service_name"]}_template.conf #{host["location"]} #{host["sfc_id"]} #{host["sfc_id_instance"]} #{host["sf_id"]} #{host["sf_id_instance"]} #{host["ipendpoint_id"]} #{host["influxdb_url"]} #{host["database_name"]}"
end end
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment