Get to Know GENI and SAVI
STEPS FOR SETTING UP
0. Prerequisites: Get a SAVI account and an Omni bundle
- Make sure you have SSH keys and SSL certificates in the GENI Portal. You can verify this by browsing to the Profile tab on the Portal and looking under SSH Keys and SSL.
- Getting a SAVI account:
- On the GENI Portal, scroll down on the Home page until you see Tools. Press the SAVI button.
- Proceed through the remaining prompts until you get an email with your SAVI username and password.
- Finally, go to http://portal.savitestbed.ca/ and login to verify that your credentials work.
- Getting an Omni bundle:
- In the GENI portal, browse to the Profile tab and then select Configure Omni. If necessary, follow the prompts to generate an SSL certificate. Then, click the Download your omni data button.
1. Install and configure the omni and GENI-SAVI federation tools
- Use
scp
to transfer theomni.bundle
file you downloaded in the pre-work from your local machine to theDownloads
folder onclient1.savitestbed.ca
.From the folder containing
omni.bundle
, run:$ scp omni.bundle <savi-username>@client1.savitestbed.ca:Downloads
When prompted, enter your SAVI username and password.
Tip: Windows users should use an SCP client of their choice (such as winscp
) - Using your SAVI credentials, log in to
client1.savitestbed.ca
usingssh
.Tip: Any SSH tool can be used for this, including the built-in terminal tools on any Unix- or Linux-based system, or the Putty and cygwin ssh on Windows. On UNIX-like systems do:
$ ssh <savi-username>@client1.savitestbed.ca
When prompted, enter your SAVI password.
- Once you are logged in, configure the omni tool.
$ omni-configure
omni-configure
should place your SSH keys (geni_key_portal
andgeni_key_portal.pub
) in your~/.ssh
folder onclient1.savitestbed.ca
.Check to make sure that the keys are in the correct location:
$ ls ~/.ssh geni_cert_portal_key geni_cert_portal_key.pub geni_key_portal geni_key_portal.pub id_rsa.pub known_hosts
- Now download and unpack the GENI-SAVI Federation Tool
$ wget http://web.uvic.ca/~sushilb/federation/tutorial.tar $ tar xvf tutorial.tar
2. Create a slice on GENI and reserve some virtual machines in it
- Now create a slice on GENI. Use
gs-<yourinitials>
as the slice name.- Change into the
tutorial
directory:cd tutorial
- In the
tutorial
directory, run:$ ./tutorial.sh createslice geni <slice_name>
When prompted, enter your SAVI username, password, and tenant.
- Change into the
- Now add a VM running Ubuntu 14 at the InstaGENI Rack assigned to you.
The general form of the command to create a VM on GENI is:
$ ./tutorial.sh createvm geni <slice-name> <rack nickname> <os_image_name>
To create the virtual machine for the exercise, run:
$ ./tutorial.sh createvm geni <slice-name> <rack nickname> Ubuntu-14-04
This will take about a minute. It will then come back with a response of the form
Result Summary: Got Reserved resources RSpec from ... To connect to the created VM please use the hostname="<name>.<rack domain name>"
The machine will now be in a booting state. It will take about 5-10 minutes before you can log in. We will use the time productively and create a SAVI VM while we wait.
3. Create a virtual machine on SAVI
- Now add a VM running Ubuntu 14 at the SAVI site assigned to you.
The general form of the command to create a VM on SAVI is
$ ./tutorial.sh createvm savi <tenant_name> <location> <os_image_name> <vm-size> <ssh_key> \ <vm-name>
Each attendee will be given a specific site and values for all parameters. The
vm-name
should be your GENI username, followed by thesitename
. e.g., forrickmcg
, the name at Toronto will berickmcg-toronto
Use the following command to reserve your SAVI node:
$ ./tutorial.sh createvm savi geniUsers <savi site> Ubuntu-14-04-64 small geni_key_portal \ <geni_username>-<savi site>
- You should now have one VM on a GENI rack and one VM at a SAVI site.
Check the status of your resources on both GENI and SAVI:
$ ./tutorial.sh listinstance geni <slice-name> $ ./tutorial.sh listinstance savi <savi site>
- Record the hostname for your GENI VM and the public IP address listed for your SAVI VM as these will be used in the next step. Notice that access to the SAVI machines are by IP address.
4. Set up Ansible for your experiment
(a) Create an Ansible inventory file
An Ansible inventory file is of the form
[group_name] server1_spec server2_spec
where group_name
is a name for a group of nodes, and a server spec contains login information for a node. An example of a server specification is:
ansible_ssh_host=142.150.208.146 ansible_ssh_port=22 ansible_ssh_user=rickmcg_geni \ ansible_ssh_private_key=~/.ssh/geni_key_portal
Create an Ansible inventory file named ansible-hosts
for your slice.
Your ansible-hosts
file should look like this:
[nodes] <geni_resource_name> ansible_ssh_port=22 ansible_ssh_user=<your_geni_username> ansible_ssh_key=~/.ssh/geni_key_portal <savi_resource_ip> ansible_ssh_port=22 ansible_ssh_user=ubuntu ansible_ssh_key=~/.ssh/geni_key_portal
Where geni_resource_name
and savi_resource_ip
are what you found from the listinstance
commands from step 3.
(b) Add private key to SSH agent
In the next step, Ansible will try to SSH into multiple nodes.
To avoid entering the passphrase for your private key multiple times, add your private key to your ssh agent as follows:
$ ssh-agent bash $ ssh-add ~/.ssh/geni_key_portal
(c) The ping module
The ping module simply tries to do a SSH login to a node and reports success or failure.
Run the following command on your controller:
$ ansible nodes -i ansible-hosts -m ping
If you don’t see success everywhere then there is something wrong with your setup. Ask one of the tutorial leaders for help.
(d) The shell module
The shell module lets you run arbitrary SSH commands in parallel across a set of hosts. It is useful for poking around, or if there is no Ansible module with the functionality you need.
Try it out:
$ ansible nodes -i ansible-hosts -m shell -a "hostname"
You can replace hostname above with any other Linux command.
(e) The setup module
The setup module gathers a bunch of information about each node and saves it in variables that you can reference in your Ansible playbook. This will be really useful for this tutorial!
Try it out on a node to see what it collects (replace <your-vm>
with your hostname):
$ ansible <your-vm> -i ansible-hosts -m setup
5. Create and run an Ansible playbook to install the software you will need
Now you will use a playbook to install the software you will need on all the nodes.
The ansible playbook you will need contains:
--- - hosts: nodes remote_user: root sudo: yes tasks: - name: Update apt cache apt: update_cache=yes - name: Install dnsutils (for dig) apt: name=dnsutils - name: Install geoip-bin (for geoiplookup) apt: name=geoip-bin - name: Install curl apt: name=curl
- To download this playbook to your client machine, type:
wget http://groups.geni.net/geni/raw-attachment/wiki/GENIExperimenter/Tutorials/GENI-SAVI/DesignSetup/software-install-solution.yaml
- Run this playbook on your Ansible control machine against all the nodes in your slice.
ansible-playbook -i ansible-hosts software-install-solution.yaml
Pro Tip: use the -f argument to ansible-playbook to speed things up -- it lets you control the number of nodes to operate on in parallel, and the default is 5. Specifying -f 20 will run the playbook's tasks against all your nodes in parallel.
|
Next: Run Experiment
Attachments (2)
-
software-install.yaml (260 bytes) - added by 10 years ago.
Ansible playbook skeleton for installing software
- software-install-solution.yaml (289 bytes) - added by 9 years ago.
Download all attachments as: .zip