Changes between Version 41 and Version 42 of GENIExperimenter/Tutorials/GENIExperimentEngine/Execute


Ignore:
Timestamp:
03/18/15 17:56:28 (9 years ago)
Author:
acb@cs.princeton.edu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/GENIExperimentEngine/Execute

    v41 v42  
    3030'''This page will log each of your queries, and you can check that all your nodes were successfully able to run the query.'''
    3131
    32 You will use Ansible to do this.  Below is a skeleton Ansible file that you use to work through the tutorial ([attachment:gee-tutorial.yaml download]).  You will need to fill in the bits marked `# INSERT ARGUMENTS HERE` based on the instructions in the following section.  If you get stuck at any point, you can take a look at one possible [attachment:solution.yaml solution] -- but don't give up too easily! 
    33 
    34 The task is to collect six pieces of information.  Three of these (the slice name, container name, and local IP) can be found from Ansible variables.  Running a {{{setup}}} command, as on the previous page, will show you the Ansible variables.  Note that {{{setup}}} is run automatically by Ansible, so when executing a playbook on a node that information is available.  Look through the output from {{{setup}}}, and you can identify
    35 the variables you'll need.
     32You will use Ansible to do this. 
     33
     34== 1. Create an Ansible playbook to install the software you'll need ==
     35
     36First you will write a playbook to install the software you'll need on all the nodes.  Below is a skeleton Ansible file that you use ([attachment:software-install.yaml download]).  You will need to fill in the bits marked `# INSERT ARGUMENTS HERE` based on the instructions in the following section.  If you get stuck at any point, you can take a look at this [attachment:software-install-solution.yaml solution].
    3637
    3738{{{
     
    4243  tasks:
    4344  - name: Update apt cache
    44     shell: apt-get update
    45 
    46   - name: Install python-apt (to work around an Ansible bug)
    47     shell: apt-get -y install python-apt
    48 
     45    apt: # INSERT ARGUMENTS HERE
     46
     47  - name: Install dnsutils (for dig)
     48    apt: # INSERT ARGUMENTS HERE
     49
     50  - name: Install geoip-bin (for geoiplookup)
     51    apt: # INSERT ARGUMENTS HERE
     52}}}
     53
     54Run this playbook on all the nodes in your slice.  You'll only need to do this step once.
     55
     56-----
     57
     58== 2. Create an Ansible playbook to download a parameterized URL from each node ==
     59
     60To solve the problems of this tutorial, you need to collect several pieces of information on each node: the container name, the IP of the host (i.e., the VM hosting the container), the IP of the container, and the latitude and longitude of the host.  Three of these (the slice name, container name, and local IP) can be found from Ansible variables.  Running a {{{setup}}} command, as on the previous page, will show you the Ansible variables.  Note that {{{setup}}} is run automatically by Ansible, so when executing a playbook on a node that information is available.  Look through the output from {{{setup}}}, and you can identify
     61the variables you'll need.  You then need to fetch a custom URL containing this information from each host.   
     62
     63Below is a skeleton Ansible file that you use ([attachment:gee-tutorial.yaml download]).  You will need to fill in the bits marked `# INSERT ARGUMENTS HERE` based on the instructions in the following section.  If you get stuck at any point, you can take a look at this [attachment:gee-tutorial-solution.yaml solution] -- but don't give up too easily!
     64
     65{{{
     66#!python
     67---
     68- hosts: nodes
     69  remote_user: root
     70  tasks:
    4971
    5072  ### (a): Get the container's FQDN ###
     
    6486
    6587  ### (d): Get the host's public IP address ###
    66   - name: Install dnsutils (for dig)
    67     apt: # INSERT ARGUMENTS HERE
    68 
    6988  - name: Get my public IP using 'dig +short'
    7089    shell: # INSERT ARGUMENTS HERE
     
    7695
    7796  ### (e): Get the latitude and longitude for each node ###
    78   - name: Install geoip-bin (for geoiplookup)
    79     apt: # INSERT ARGUMENTS HERE
    80 
    8197  - name: Download GeoLiteCity DB
    8298    get_url: # INSERT ARGUMENTS HERE
     
    101117
    102118  ### (f): Fetch the parameterized URL ###
    103   - name: Dump the full URL, to make sure it looks OK 
     119  - name: Dump the full URL, to make sure it looks OK
    104120    debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE"
    105121
     
    108124}}}
    109125
    110 
    111 -----
    112 
    113 == 1. Create an Ansible playbook to download a parameterized URL from each node ==
    114 
    115 To solve the problems of this tutorial, you need to collect several pieces of information on each node: the container name, the IP of the host (i.e., the VM hosting the container), the IP of the container, and the latitude and longitude of the host.  You then need to fetch a custom URL containing this information from each host.   The following subsections provide guidance on how to complete each step.
     126The following subsections provide further guidance on how to complete each step.
    116127
    117128=== (a) Get the container's FQDN ===
    118129
    119 Look at the variables collected by Ansible's setup module.  Find one that holds the container's fully-qualified domain name (e.g., slice347.pcvm1-1.instageni.iu.edu) and dump it using a '''debug''' task. 
     130Look at the variables collected by Ansible's '''setup''' module.  Find one that holds the container's fully-qualified domain name (e.g., slice347.pcvm1-1.instageni.iu.edu) and dump it using a '''debug''' task. 
    120131
    121132=== (b) Get the container IP address ===
    122133
    123 Look at the variables collected by Ansible's setup module.  Find one that holds the container IP address and dump it using a '''debug''' task.
     134Look at the variables collected by Ansible's '''setup''' module.  Find one that holds the container IP address and dump it using a '''debug''' task.
    124135
    125136=== (c) Get the control host name ===
    126137
    127 Look at the variables collected by Ansible's setup module.  Find one that holds the control host's FQDN (HINT: it begins with ''pcvm'') and dump it using a '''debug''' task.  You'll need this for the next step.
     138Look at the variables collected by Ansible's '''setup''' module.  Find one that holds the control host's FQDN (HINT: it begins with ''pcvm'') and dump it using a '''debug''' task.  You'll need this for the next step.
    128139
    129140=== (d) Get the host's public IP address ===
     
    171182----
    172183
    173 == 2. Run the playbook ==
     184== 3. Run the playbook ==
    174185
    175186Once you have finished your playbook, run it against all the nodes! 
    176187
    177 As a data point, our Ansible playbook contained six commands (not including debug commands) and used the '''apt''', '''shell''', and '''get_url''' modules.  It took about 10 minutes to fully execute over the entire GENI
    178 Experiment Engine substrate.
    179 
    180 ----
    181 
    182 == 3. Verify that your playbook worked as expected ==
     188----
     189
     190== 4. Verify that your playbook worked as expected ==
    183191
    184192Once you have completed the tutorial, you can check where you’ve said hello from at: