Changes between Version 13 and Version 14 of GENIExperimenter/Tutorials/GENIExperimentEngine/Execute


Ignore:
Timestamp:
03/14/15 09:31:27 (9 years ago)
Author:
acb@cs.princeton.edu
Comment:

--

Legend:

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

    v13 v14  
    102102=== (d) Get the host's public IP address ===
    103103
    104 For instance, how to get the host's IP address? The IP address visible inside the slicelet (as reported in the variable ''ansible_eth0.ipv4.address'') is a private address -- it is not the control address of the host.  There are a number of ways that you could discover the control address, including running '''dig +short''' on the host’s name (see if you can find a variable that contains this; HINT: you need it to SSH into the slicelet) or by running '''curl''' against a webserver that reports the client’s externally visible address.
     104This is a bit trickier: how to get the host's IP address? The IP address visible inside the slicelet (as reported in the variable ''ansible_eth0.ipv4.address'') is a private address -- it is not the control address of the host.  There are a number of ways that you could discover the control address, including running '''dig +short''' on the host’s name (see if you can find a variable that contains the host's name; HINT: you need it to SSH into the slicelet) or by running '''curl''' against a webserver that reports the client’s externally visible address.
    105105
    106106|| [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' The '''ansible''' command-line tool is a good way to try out Ansible commands before putting them in your playbook. ||
     
    110110|| [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' When you run an Ansible command in a playbook, you can save the output into a new variable using '''register: varname'''  Then you can retrieve the value later in the playbook using ''{{ varname }}'' or, for shell command output, ''{{ varname.stdout }}'' ||
    111111
    112 Another requirement of the lab is to map the control IP address obtained above to the latitude and longitude for each node.  For instance you can use the '''geoiplookup''' tool, provided by package '''geoip-bin'''.
     112=== (e) Get the latitude and longitude for each node ===
     113
     114Another requirement of the lab is to map the host's control IP address obtained in the previous step to the latitude and longitude for each node.  One way to do this is to use the '''geoiplookup''' tool, provided by package '''geoip-bin'''.
    113115
    114116{{{
     
    117119
    118120where ''<data file>'' is the database of IP addresses and locations.  You can find a good one at: http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz, which you’ll have to download to each node and unzip.   
     121
    119122A different approach would be to run '''curl''' against a webserver that maps IP address to latitude and longitude, such as http://ipinfo.io, and parse the output.  '''NOTE:''' this particular website rate-limits the number of requests per node per day, so if you use it, ''make only a single request per node and save the result in a file''… keep in mind that everyone in the tutorial may be hitting this server from the same set of hosts!
    120123
     
    122125
    123126|| [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' Not all the resources you may need are installed on the nodes!  The '''apt''' Ansible module is useful for installing packages; see: http://docs.ansible.com/apt_module.html ||
    124 
    125127
    126128At this point, you should have enough information to flesh out the base Ansible playbook.  No need to hurry.  Do each step, one at a time, and use the '''debug''' module to print out variable values after each step.  This will help you get something working very quickly.