= [http://groups.geni.net/geni/wiki/GENIExperimenter/Tutorials/AnsibleHelloGENI Title of the Experiment] =
{{{
#!html
}}}
== 1. Design the Experiment ==
In this exercise we will convert the [wiki:GENIExperimenter/Tutorials/RunHelloGENI HelloGENI exercise] install script into an Ansible playbook.
You may want to quickly run the [wiki:GENIExperimenter/Tutorials/RunHelloGENI HelloGENI exercise] to see how it works.
{{{
#!div style="background: #fdd; border: 3px ridge; width: 800px;"
For reference here is the install script pruned to only handle Apache 2.2 (the original handles multiple versions of Apache).
{{{
#!sh
#!/bin/bash
#----------------------------------------------------------------------
# Copyright (c) 2012 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Work, and to permit persons to whom the Work
# is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Work.
#
# THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
# IN THE WORK.
#----------------------------------------------------------------------
# Usual directory for downloading software in ProtoGENI hosts is `/local`
cd /local
#Get the hostname to see if we are at the server or the client
hn=`echo $HOSTNAME | cut -d'.' -f 1`
##### Check if file is there #####
if [ ! -f "./installed.txt" ]
then
#### Create the file ####
sh -i -c `sudo touch "./installed.txt"`
#### Run one-time commands ####
#Install necessary packages
sudo apt-get update
sudo apt-get -y install apache2 iperf & EPID=$!
wait $EPID
# Install custom software
## Customize apache installation
## Reboot the host if needed
fi
##### Run Boot-time commands
# Start services
# If this is the server then start the iperf and configure and start the http server
if [ $hn == "server" ]
then
# Enable web server stats
sudo /usr/sbin/a2enmod status
sudo rm /etc/apache2/mods-enabled/status.conf
echo "" | sudo tee -a /etc/apache2/sites-available/default > /dev/null
echo " SetHandler server-status" |sudo tee -a /etc/apache2/sites-available/default > /dev/null
echo " Allow from all" | sudo tee -a /etc/apache2/sites-available/default > /dev/null
echo "" | sudo tee -a /etc/apache2/sites-available/default > /dev/null
echo "ExtendedStatus On" | sudo tee -a /etc/apache2/conf.d/extendedstatus > /dev/null
# Copy the website under /var/www/
sudo cp -R ./website/* /var/www/
sudo rm -rf /var/www/html
sudo ln -s /var/www/ /var/www/html
# Start the webserver
sudo /usr/sbin/apache2ctl restart
sudo service apache2 restart
# Start the iperf server
sudo mkdir -p /var/www/iperflogs
iperf_server_log="/var/www/iperflogs/iperf-server.log"
sudo bash -c "iperf -s -i 10 &> $iperf_server_log"
else
# If this is the client start the script for transfers
# Wait 60 seconds just to give some time to the server to come up
sleep 60
./scripts/client-wget.sh&
./scripts/client-iperf.sh&
fi
# Start my service -- assume it was installed at /usr/local/bin
}}}
}}}
== 2. Establish the Environment ==
1. Execute these commands:
{{{
$ cd mydir
$ ssh my.host.com
}}}
Expected Output
{{{
This is the output that I should see
}}}
== 3. Obtain Resources ==
1. Use diagrams and screenshots to show topologies and user interfaces. Label your figures for easy reference.
{{{
#!html
Figure (1)
|
}}}
2. Videos are a great tool to illustrate multi-step visual processes. Make sure to also include the textual steps, however, in case they are not able to play the video.
{{{
#!html
|
- Go to http://www.protogeni.net/flack and press the Log in button
- From the select authority drop down menu, select the site authority for your GENI account, most probably pgeni.gpolab.bbn.com and press the Download button
- Answer yes in the pop-up window
- Login to the new window using your GENI account
- Reload the Flack tab and repeat steps 1 and 2
- After your private key and certificate are loaded, type your GENI passphrase in the box
- Select the sites you want. For this tutorial we only need the utahemulab.cm site.
|
}}}
=== Warnings ===
{{{
#!html
|
Your sliver will expire in 2 days!
|
}}}
=== Notes ===
{{{
#!html
|
Write down your slice name on your worksheet.
|
}}}
=== Tips ===
{{{
#!html
|
You can download your certificate from your slice authority.
|
}}}
----
= [wiki:GENIExperimenter/Tutorials/AnsibleHelloGENI Introduction] =
= [wiki:GENIExperimenter/Tutorials/AnsibleHelloGENI/Execute Next: Execute] =