mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			120 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			120 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
# -*- mode: ruby -*-
 | 
						|
# vi: set ft=ruby :
 | 
						|
#
 | 
						|
#  Licensed to the Apache Software Foundation (ASF) under one
 | 
						|
#  or more contributor license agreements.  See the NOTICE file
 | 
						|
#  distributed with this work for additional information
 | 
						|
#  regarding copyright ownership.  The ASF licenses this file
 | 
						|
#  to you under the Apache License, Version 2.0 (the
 | 
						|
#  "License"); you may not use this file except in compliance
 | 
						|
#  with the License.  You may obtain a copy of the License at
 | 
						|
#  
 | 
						|
#    http://www.apache.org/licenses/LICENSE-2.0
 | 
						|
#  
 | 
						|
#  Unless required by applicable law or agreed to in writing,
 | 
						|
#  software distributed under the License is distributed on an
 | 
						|
#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 | 
						|
#  KIND, either express or implied.  See the License for the
 | 
						|
#  specific language governing permissions and limitations
 | 
						|
#  under the License.
 | 
						|
#
 | 
						|
 | 
						|
xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
 | 
						|
 | 
						|
is_windows = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/)
 | 
						|
 | 
						|
virtualbox_interface_0 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter' else 'vboxnet0' end
 | 
						|
virtualbox_interface_1 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #2' else 'vboxnet1' end
 | 
						|
virtualbox_interface_2 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #3' else 'vboxnet2' end
 | 
						|
 | 
						|
VAGRANTFILE_API_VERSION = '2'
 | 
						|
Vagrant.require_version '>= 1.5.0'
 | 
						|
 | 
						|
unless Vagrant.has_plugin?('vagrant-berkshelf')
 | 
						|
  raise 'vagrant-berkshelf is not installed!'
 | 
						|
end
 | 
						|
 | 
						|
unless Vagrant.has_plugin?('vagrant-omnibus')
 | 
						|
  raise 'vagrant-omnibus is not installed!'
 | 
						|
end
 | 
						|
 | 
						|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
 | 
						|
 | 
						|
  config.vm.define 'xenserver' do |xenserver|
 | 
						|
    xenserver.vm.box = 'duffy/xenserver'
 | 
						|
 | 
						|
    # Public Network (IP address is ignored.)
 | 
						|
    xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.23.10'
 | 
						|
 | 
						|
    # Guest Network (IP address is ignored.)
 | 
						|
    xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.24.10'
 | 
						|
 | 
						|
    ## Configure Management Interface
 | 
						|
    xenserver.vm.provision 'shell' do |s|
 | 
						|
      s.path = xenserver_networking_script
 | 
						|
      s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
 | 
						|
    end
 | 
						|
 | 
						|
    ## Configure Public Interface
 | 
						|
    xenserver.vm.provision 'shell' do |s|
 | 
						|
      s.path = xenserver_networking_script
 | 
						|
      s.args = %w(eth2 na na PUBLIC)
 | 
						|
    end
 | 
						|
 | 
						|
    ## Configure Guest Interface
 | 
						|
    xenserver.vm.provision 'shell' do |s|
 | 
						|
      s.path = xenserver_networking_script
 | 
						|
      s.args = %w(eth3 na na GUEST)
 | 
						|
    end
 | 
						|
 | 
						|
    ## Map host only networks and the adapters
 | 
						|
    xenserver.vm.provider 'virtualbox' do |v|
 | 
						|
      v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
 | 
						|
      v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
 | 
						|
      v.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all']
 | 
						|
      v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
 | 
						|
      v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1]
 | 
						|
      v.customize ['modifyvm', :id, '--hostonlyadapter4', virtualbox_interface_2]
 | 
						|
      v.customize ['modifyvm', :id, '--memory', 6144]
 | 
						|
    end
 | 
						|
 | 
						|
    ## Tweak kernel
 | 
						|
    xenserver.vm.provision "shell", inline: "sed -i -e 's/net.bridge.bridge-nf-call-iptables = 1/net.bridge.bridge-nf-call-iptables = 0/g' -e 's/net.bridge.bridge-nf-call-arptables = 1/net.bridge.bridge-nf-call-arptables = 0/g' /etc/sysctl.conf && /sbin/sysctl -p /etc/sysctl.conf"
 | 
						|
  end
 | 
						|
  
 | 
						|
  config.vm.define 'management' do |management|
 | 
						|
    management.vm.box = 'bento/centos-6.7'
 | 
						|
 | 
						|
    management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
 | 
						|
    management.vm.network :private_network, :auto_config => true, :ip => '192.168.23.5'
 | 
						|
 | 
						|
    management.vm.network 'forwarded_port', guest: 3306, host: 3306
 | 
						|
    management.vm.network 'forwarded_port', guest: 8080, host: 8080
 | 
						|
 | 
						|
    management.vm.provider 'virtualbox' do |v|
 | 
						|
      v.customize ['modifyvm', :id, '--memory', 2048]
 | 
						|
      v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
 | 
						|
      v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1]
 | 
						|
    end
 | 
						|
 | 
						|
    if Vagrant.has_plugin?('vagrant-cachier')
 | 
						|
      management.cache.scope = :box
 | 
						|
      management.cache.auto_detect = true
 | 
						|
      management.omnibus.cache_packages = true
 | 
						|
    end
 | 
						|
 | 
						|
    management.omnibus.chef_version = "11.16.4" 
 | 
						|
    management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
 | 
						|
    management.berkshelf.enabled = true
 | 
						|
 | 
						|
 | 
						|
    CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
 | 
						|
 | 
						|
    management.vm.provision :chef_solo do |chef|
 | 
						|
      chef.log_level = :debug
 | 
						|
      chef.run_list = CHEF_CONFIGURATION.delete('run_list')
 | 
						|
      chef.json = CHEF_CONFIGURATION
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |