Merge "labs: remove Vagrant files"
This commit is contained in:
commit
7b66351f26
110
labs/Vagrantfile
vendored
110
labs/Vagrantfile
vendored
@ -1,110 +0,0 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Vagrantfile
|
||||
# Author: Trevor Roberts Jr (VMTrooper@gmail.com)
|
||||
#
|
||||
# NOTE: Before attempting to use this file, follow the required Vagrant
|
||||
# deployment steps:
|
||||
#
|
||||
# http://docs.vagrantup.com/v2/installation/index.html
|
||||
#
|
||||
# This file directs Vagrant on how to deploy the student VMs.
|
||||
# It is possible to do a single-VM or multi-VM deployment based on
|
||||
# the entries that are enabled in the "nodes" hash at the start of this file.
|
||||
#
|
||||
# By default, only the single VM (allinone) deployment type is enabled.
|
||||
# For multi-VM, comment out 'allinone' and uncomment 'controller', 'compute',
|
||||
# and 'network'.
|
||||
#
|
||||
# Vagrant uses VirtualBox Guest Additions to modify VM properties
|
||||
# (hostname, IP, resource allocation) according to VM function.
|
||||
#
|
||||
# Vagrant's shell provisioner receives deployment instructions from the
|
||||
# following files:
|
||||
# allinone.sh
|
||||
# controller.sh
|
||||
# compute.sh
|
||||
# network.sh
|
||||
# Removing these files without removing the shell provisioner command will
|
||||
# cause Vagrant errors.
|
||||
#
|
||||
# After determining the deployment type, build this environment by typing this
|
||||
# command at the prompt:
|
||||
#
|
||||
# vagrant up
|
||||
#
|
||||
# Verify your VM status by typing this command at the prompt:
|
||||
# vagrant status
|
||||
#
|
||||
# SSH to your VM by typing this command at the prompt:
|
||||
# vagrant ssh vmname (for example: vagrant ssh compute)
|
||||
#
|
||||
# See the remaining OpenStack Training Labs code for more details at GitHub:
|
||||
# https://github.com/openstack/openstack-manuals/tree/master/doc/training-guides/training-labs
|
||||
nodes = {
|
||||
'allinone' => 51,
|
||||
# 'controller' => 51,
|
||||
# 'compute' => 52,
|
||||
# 'network' => 53,
|
||||
}
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
# Every Vagrant virtual environment requires a box (similar to OVA) to build
|
||||
# from. The Vagrantfile currently uses Ubuntu 14.04 LTS (aka Trusty
|
||||
# Thar). Modify the line below and the box_url line to use a different
|
||||
# distribution
|
||||
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
# The URL from where the 'config.vm.box' box will be fetched if it
|
||||
# doesn't already exist on the user's system.
|
||||
config.vm.box_url = "https://vagrantcloud.com/ubuntu/trusty64"
|
||||
|
||||
# Define each VM's settings (ex: hostname, IP address, RAM, vCPU, etc.)
|
||||
nodes.each do |prefix, fourth_octet|
|
||||
config.vm.define "#{prefix}" do |box|
|
||||
box.vm.hostname = "#{prefix}"
|
||||
# Management network
|
||||
box.vm.network :private_network, ip: "10.10.10.#{fourth_octet}", :netmask => "255.255.255.0"
|
||||
# Data network
|
||||
box.vm.network :private_network, ip: "10.20.20.#{fourth_octet}", :netmask => "255.255.255.0"
|
||||
# API network
|
||||
box.vm.network :private_network, ip: "192.168.100.#{fourth_octet}", :netmask => "255.255.255.0"
|
||||
# Forward port 80 to host port 8080 for only the controller or
|
||||
# all-in-one deployment for Horizon
|
||||
if prefix == "controller" or prefix == "allinone"
|
||||
box.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
end
|
||||
# Run the shell provisioning script file (as root)
|
||||
box.vm.provision :shell, :path => "scripts/vagrant/#{prefix}.sh"
|
||||
# Advanced VirtualBox settings
|
||||
box.vm.provider :virtualbox do |vbox|
|
||||
# Single node resource allocations; will be more selective for
|
||||
# multi-node
|
||||
vbox.customize ["modifyvm", :id, "--memory", 2048]
|
||||
vbox.customize ["modifyvm", :id, "--cpus", 2]
|
||||
# Multi-node resource allocation based on the prefix name
|
||||
if prefix == "controller"
|
||||
vbox.customize ["modifyvm", :id, "--memory", 1024]
|
||||
vbox.customize ["modifyvm", :id, "--cpus", 1]
|
||||
elsif prefix == "compute"
|
||||
vbox.customize ["modifyvm", :id, "--memory", 2048]
|
||||
vbox.customize ["modifyvm", :id, "--cpus", 2]
|
||||
elsif prefix == "network"
|
||||
vbox.customize ["modifyvm", :id, "--memory", 1024]
|
||||
vbox.customize ["modifyvm", :id, "--cpus", 1]
|
||||
end
|
||||
# nicpromisc flag begins nic count at 1, not 0
|
||||
# Setting all NICs to promiscuous mode per Pranav's specification
|
||||
vbox.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
||||
vbox.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
|
||||
vbox.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,8 +0,0 @@
|
||||
# Used by guest scripts
|
||||
|
||||
# Name of VirtualBox shared folder
|
||||
SHARE_NAME=vagrant
|
||||
|
||||
VM_SHELL_USER=vagrant
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
@ -1 +0,0 @@
|
||||
run_scripts.sh
|
@ -1 +0,0 @@
|
||||
run_scripts.sh
|
@ -1 +0,0 @@
|
||||
run_scripts.sh
|
@ -1 +0,0 @@
|
||||
run_scripts.sh
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o errexit
|
||||
|
||||
# Shell provisioning script is renamed and copied to /tmp before being run as
|
||||
# root
|
||||
TOP_DIR=/vagrant
|
||||
source "$TOP_DIR/config/paths"
|
||||
source "$LIB_DIR/functions.guest"
|
||||
|
||||
clean_dir "$LOG_DIR"
|
||||
|
||||
exec_logpath "$LOG_DIR/$HOSTNAME.log"
|
||||
|
||||
function vagrant_start_from_config {
|
||||
local config_file=$1
|
||||
local config_path=$CONFIG_DIR/$config_file
|
||||
|
||||
if [ ! -f "$config_path" ]; then
|
||||
echo >&2 "Config file not found: $config_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
while read -r field_1 field_2; do
|
||||
if [[ $field_1 =~ ^# ]]; then
|
||||
# Skip lines that are commented out
|
||||
continue
|
||||
elif [[ "$field_1" = cmd || "$field_1" = osbash ]]; then
|
||||
# Skip osbash commands and scripts for Vagrant
|
||||
continue
|
||||
else
|
||||
local dir="$(src_dir_code_to_dir "$field_1")"
|
||||
local scr_path=$dir/$field_2
|
||||
echo "$scr_path"
|
||||
as_root_exec_script "$scr_path"
|
||||
fi
|
||||
done < "$config_path"
|
||||
}
|
||||
|
||||
# The Vagrantfile uses Ubuntu
|
||||
for config_file in "scripts.ubuntu" "scripts.$HOSTNAME"; do
|
||||
echo "Config file $config_file"
|
||||
vagrant_start_from_config "$config_file"
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user