Add and enable Vagrant script
This changeset adds vagrant/run_scripts.sh, a script executed by the Vagrant shell provisioner inside the node VM. run_scripts.sh executes the scripts enabled in: config/scripts.nodeinit_vagrant config/scripts.ubuntu config/scripts.$HOSTNAME Note that while Vagrant calls run_scripts.sh through symlinks named after the nodes (controller.sh, network.sh, compute.sh), this has no effect because run_scripts.sh relies on the hostname to select the configuration. The symlinks (and the Vagrantfile section that calls them) can be removed once we are reasonably sure that we don't want to have node-specific scripts for Vagrant on the host-side. Partial-Bug: 1312764 Implements: blueprint openstack-training-labs Change-Id: Ia5cfee0acddae26bd41e39b9185ed3d5990539f6
This commit is contained in:
parent
8c7bbe82be
commit
0caf4cf52e
4
labs/Vagrantfile
vendored
4
labs/Vagrantfile
vendored
@ -80,8 +80,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
if prefix == "controller" or prefix == "allinone"
|
||||
box.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
end
|
||||
# Run the shell provisioning script file
|
||||
box.vm.provision :shell, :path => "#{prefix}.sh"
|
||||
# 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
|
||||
|
1
labs/scripts/vagrant/allinone.sh
Symbolic link
1
labs/scripts/vagrant/allinone.sh
Symbolic link
@ -0,0 +1 @@
|
||||
run_scripts.sh
|
1
labs/scripts/vagrant/compute.sh
Symbolic link
1
labs/scripts/vagrant/compute.sh
Symbolic link
@ -0,0 +1 @@
|
||||
run_scripts.sh
|
1
labs/scripts/vagrant/controller.sh
Symbolic link
1
labs/scripts/vagrant/controller.sh
Symbolic link
@ -0,0 +1 @@
|
||||
run_scripts.sh
|
1
labs/scripts/vagrant/network.sh
Symbolic link
1
labs/scripts/vagrant/network.sh
Symbolic link
@ -0,0 +1 @@
|
||||
run_scripts.sh
|
21
labs/scripts/vagrant/run_scripts.sh
Normal file
21
labs/scripts/vagrant/run_scripts.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/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"
|
||||
|
||||
# The Vagrantfile uses precise, so we know it's Ubuntu
|
||||
for CONFIG_FILE in "scripts.nodeinit_vagrant" "scripts.ubuntu" "scripts.$HOSTNAME"; do
|
||||
echo "Config file $CONFIG_FILE"
|
||||
get_script_paths_from_config "$CONFIG_FILE" | while read SCR_PATH; do
|
||||
echo "$SCR_PATH"
|
||||
as_root_exec_script "$SCR_PATH"
|
||||
done
|
||||
done
|
Loading…
Reference in New Issue
Block a user