Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an MOTD when logging into the vagrant instances #115

Merged
merged 1 commit into from
Jun 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,42 @@ SCRIPT
#SCRIPT
# POLLY IN A REMOTE MODE IS CURRENTLY NOT SUPPORTED, UNCOMMENT WHEN IT IS

#write the MOTD to help users get started
$motd_file = "/etc/motd"

$write_motd_config = <<SCRIPT
mkdir -p #{File.dirname($motd_file).shellescape}
cat << EOF > #{$motd_file.shellescape}

----------------------------------------------
This host is running:
polly @ /usr/bin/polly
rexray @ /usr/bin/rexray

Sample commands for REX-Ray (can run on node0 or node1):
----------------------------------------------
Create a volume:
rexray volume create --volumename=node0vol --size=1

List volumes:
rexray volume


Sample commands for Polly (run on node0 only + must sudo su):
----------------------------------------------
Create a volume:
polly volume create --servicename=virtualbox --name=pollyvol --size=1

List volumes:
polly volume ls

Delete volume:
polly volume remove --volumeid=<Volume UUID>
----------------------------------------------

EOF
SCRIPT

# init the environment variables used when building go source
$build_env_vars = Hash[
"GOPATH" => $gopath.shellescape,
Expand Down Expand Up @@ -334,6 +370,12 @@ Vagrant.configure("2") do |config|
s.inline = "/etc/init.d/rexray start"
end

# write MOTD
node.vm.provision "shell" do |s|
s.name = "write MOTD"
s.inline = $write_motd_config
end

end # if is_first_up node.vm.hostname

# list volume mapping with rex-ray to verify configuration
Expand Down Expand Up @@ -433,6 +475,12 @@ Vagrant.configure("2") do |config|
#end
# POLLY IN A REMOTE MODE IS CURRENTLY NOT SUPPORTED, UNCOMMENT WHEN IT IS

# write MOTD
node.vm.provision "shell" do |s|
s.name = "write MOTD"
s.inline = $write_motd_config
end

end # if is_first_up node.vm.hostname

# list volume mapping with rex-ray to verify configuration
Expand Down