# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
our_domain = "p4demo.com"
# Read VM config from JSON file.
helix_config = (JSON.parse(File.read("helix_server.json")))
class HSError < Vagrant::Errors::VagrantError
error_key "Helix Server Configuration error"
end
if !helix_config.has_key?("oses")
raise HSError.new("Please define boxes in helix_server.json file.")
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
config.ssh.forward_agent = true
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
end
helix_config['oses'].each do |os|
osname = os['osname']
os['nodes'].each do |node|
#hostname = "#{osname}-#{node[':nodename']}"
hostname = "#{node[':nodename']}"
os_bootstrap = "bootstrap-#{osname}.sh"
config.vm.define hostname.to_sym do |machine|
if Vagrant.has_plugin?("vagrant-cachier")
machine.cache.scope = :box
end
machine.vm.box = os['box']
machine.vm.box_url = os['box_url']
machine.vm.synced_folder "./shared", "/shared"
# Set the root password to 'F@stSCM!'
machine.vm.provision "shell", inline: "echo 'root:F@stSCM!' | sudo chpasswd"
# Updated the VM and install various packages.
machine.vm.provision :shell, :path => os_bootstrap
# Prepare for Perforce operation.
machine.vm.provision :shell, :path => "bootstrap-sdp-setup.sh"
# Run initial CBD Test Suite.
machine.vm.provision :shell, :path => "auto_test_cbd_vagrant.sh"
machine.vm.network :private_network, ip: node[':ip']
machine.vm.hostname = hostname + "." + our_domain
machine.hostmanager.aliases = ["#{hostname}.localdomain", "#{hostname}"]
end
end
end
end
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #4 | 19253 | C. Thomas Tyler | Routine merge-down from main to dev. | ||
| #3 | 14928 | C. Thomas Tyler | Tweakes to Vagrant test flow. | ||
| #2 | 14904 | C. Thomas Tyler |
Prepared CentOS VM, initialized by Vagrant (command-line virtual machine management) for ground-up test environment building, starting from the vanilla CentOS OS installation. Modified startup scripts to use the Helix Installer to simpfliy the bulk of the installation. Added test config file for testing on Vagrant-initialized 'helix-01' box. |
||
| #1 | 11354 | C. Thomas Tyler | Started work on Vagrant test harness. |