Changes between Version 5 and Version 6 of GENIExperimenter/Tutorials/GENI-SAVI/DesignSetup


Ignore:
Timestamp:
05/26/15 11:57:17 (9 years ago)
Author:
rick@mcgeer.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/GENI-SAVI/DesignSetup

    v5 v6  
    9696}}}
    9797
    98 we have chosen values for all parameters.  The vm-name should be your geni-username
    99 {{{
    100 $ ./tutorial.sh createvm savi <tenant_name> toronto ubuntu-14-04-64 small savi_tutorial <geni_username>
    101 $  ./tutorial.sh createvm savi <tenant_name> victoria ubuntu-14-04-64 small savi_tutorial <geni_username>
    102 }}}
    103 
    104 We now have VMs at Cornell, Utah, Toronto, and Victoria.
    105 
    106 {{{
    107 $ ssh -i id_rsa -F ssh-config slice338.pcvm3-1.instageni.metrodatacenter.com
    108 }}}
    109 
    110 Type '''ifconfig eth0'''.  You should see an eth0 interface with an IP address in the 10.0.0.0/8 range, a ''private'' IP address. 
    111 
    112 {{{
    113 root@slice347:~# ifconfig eth0
    114 eth0      Link encap:Ethernet  HWaddr a6:24:c1:df:c7:09
    115           inet addr:10.20.0.243  Bcast:0.0.0.0  Mask:255.255.0.0
    116           inet6 addr: fe80::a424:c1ff:fedf:c709/64 Scope:Link
    117           UP BROADCAST RUNNING  MTU:1500  Metric:1
    118           RX packets:56555 errors:0 dropped:2 overruns:0 frame:0
    119           TX packets:49525 errors:0 dropped:0 overruns:0 carrier:0
    120           collisions:0 txqueuelen:1000
    121           RX bytes:93890170 (93.8 MB)  TX bytes:8052865 (8.0 MB)
    122 }}}
    123 
    124 This IP address is behind a NAT and not directly reachable from outside (i.e., from the Internet).  However all nodes in your slicelet can contact each other using the private addresses.
    125 
    126 The nodes in your '''ssh-config''' file are Docker containers running on (virtual) hosts.  These hosts have ''public'' IP addresses that are routable from the Internet, that's why you can login to the Docker containers of your slicelet.  A port on the public IP address (e.g., 49155) is forwarded to the SSH port (22) on the container's private IP address.  The '''ssh-config''' file contains the names of the virtual hosts and the port forwarding information.   
    127 
    128 When you run a server on a node in your slicelet, it will listen on the private address, because that is the only one it can see.  By default it will only be visible to other nodes in your slicelet.  Docker provides facilities for exposing ports to the public Internet, but this topic is outside the scope of this tutorial. 
    129 
    130 ''Note that later on you will need to find both the ''public'' and ''private'' IP addresses for each node in the slicelet.''
    131 
    132 ----
    133 
    134 == 3. Configure the Ansible controller for your slicelet ==
    135 
    136 If you already have Ansible installed on your laptop, then you can use it as the controller for this experiment.  Otherwise, you will use one of the nodes in your slicelet as the Ansible controller.  Pick one, log into it, and install ansible using apt-get:
    137 
    138 {{{
    139 $ apt-get update
    140 $ apt-get install ansible
    141 }}}
    142 
    143 Then upload your slicelet helper files to that node.  {{{scp}}} can be used for this; in the directory where you unzipped the files, run a command like the following:
    144 
    145 {{{
    146 $ scp -F ssh-config * ansible-hosts slice323.pcvm3-1.instageni.metrodatacenter.com:
    147 }}}
    148 
    149 || [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' remove your controller node from the '''ansible_hosts''' file after you’ve uploaded. ||
    150 
    151 ----
     98we have chosen values for all parameters.  The vm-name should be your geni-username, followed by the sitename.  E.g., for rickmcg, the name at Toronto will be rickmcg-toronto
     99{{{
     100$ ./tutorial.sh createvm savi <tenant_name> toronto ubuntu-14-04-64 small savi_tutorial <geni_username>-toronto
     101$  ./tutorial.sh createvm savi <tenant_name> victoria ubuntu-14-04-64 small savi_tutorial <geni-username>-victoria
     102}}}
     103
     104We now have VMs at Cornell, Utah, Toronto, and Victoria.   Check the status of your resources on both GENI and SAVI
     105
     106{{{
     107$ ./tutorial.sh listinstance geni
     108$ ./tutorial.sh listinstance savi
     109}}}
     110
     111Notice that access to the SAVI machines are by IP address
    152112
    153113== 4. Learn some basic concepts of Ansible ==
     
    155115Ansible (http://docs.ansible.com) is a free, open-source, intuitive IT automation tool that is well-suited to the tasks in this tutorial.  Ansible commands can be run from the command line or put in a YAML file called a ''playbook''.  We will be creating an Ansible playbook to run the parameterized HTTP query described earlier.
    156116
    157 Two basic concepts in Ansible are ''inventories'' and ''modules''.  An inventory is a list of hosts to be managed by Ansible, organized into groups.  When you run Ansible commands, either from the command-line or in a playbook, you specify the host group that the command should operate on.  In this way Ansible commands can operate on many hosts in parallel.  Take a look at the Ansible inventory in your '''ansible-hosts''' file.  This is basically the equivalent of the '''ssh-config''' except its specialized for Ansible.
     117Two basic concepts in Ansible are ''inventories'' and ''modules''.  An inventory is a list of hosts to be managed by Ansible, organized into groups.  When you run Ansible commands, either from the command-line or in a playbook, you specify the host group that the command should operate on.  In this way Ansible commands can operate on many hosts in parallel.  Take a look at the Ansible inventory in your '''ansible-hosts''' file.  This is basically the equivalent of the '''ssh-config''' except it's specialized for Ansible.
    158118
    159119A ''task'' in Ansible consists of a module and some arguments for the module.  A module provides a declarative abstraction on top of standard shell commands.  So for example, in the shell on an Ubuntu machine you might install package “foo” like this:
     
    180140Here are a few Ansible tasks to run, to get some experience with the command-line interface. 
    181141
    182 === (a) The ping module ===
     142=== (a) Create an Ansible Hosts file ===
     143
     144An Ansible hosts file is of the form
     145{{{
     146server1.example.com
     147server2.example.com
     148}}}
     149or
     150{{{
     151server1.example.com ansible_ssh_host=10.0.0.1
     152server2.example.com ansible_ssh_host=10.0.0.2
     153}}}
     154Create an Ansible Hosts file for your slice.  An example is here:
     155
     156=== (b) The ping module ===
    183157
    184158The '''ping''' module simply tries to do a SSH login to a node and reports success or failure.  Run the following command on your controller:
     
    190164If you don’t see success everywhere then there is something wrong with your setup.  Ask one of the tutorial leaders for help. 
    191165
    192 === (b) The shell module ===
     166=== (c) The shell module ===
    193167
    194168The '''shell''' module lets you run arbitrary SSH commands in parallel across a set of hosts.  It’s useful for poking around, or if there is no Ansible module with the functionality you need.  Try it out:
     
    200174You can replace ''hostname'' above with any other Linux command.
    201175
    202 === (c) The setup module ===
    203 
    204 The '''setup''' module gathers a bunch of information about each node and saves it in variables that you can reference in your Ansible playbooks.  This will be really useful to do the tutorial!   Try it out on a node to see what it collects (replace `<your-slicelet>` with your slicelet’s name):
    205 
    206 {{{
    207 $ ansible <your-slicelet>.pcvm1-1.instageni.wisc.edu -i ansible-hosts -m setup
    208 }}}
    209 
    210 === (d) A simple playbook ===
     176=== (d) The setup module ===
     177
     178The '''setup''' module gathers a bunch of information about each node and saves it in variables that you can reference in your Ansible playbooks.  This will be really useful to do the tutorial!   Try it out on a node to see what it collects (replace `<your-vm>` with your hostname):
     179
     180{{{
     181$ ansible <yourvm>.utahddc.geniracks.net -i ansible-hosts -m setup
     182}}}
     183
     184=== (e) A simple playbook ===
    211185
    212186Next, we will look at a simple Ansible playbook.  An Ansible playbook is a YAML file containing a list of Ansible tasks.  Copy the playbook below into a file called test.yaml: