Changes between Version 34 and Version 35 of GENIExperimenter/Tutorials/GENIExperimentEngine/Execute


Ignore:
Timestamp:
03/17/15 10:55:45 (9 years ago)
Author:
acb@cs.princeton.edu
Comment:

--

Legend:

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

    v34 v35  
    3636== 1. Experiment with Ansible ==
    3737
    38 We will first get familiar with some basic Ansible tasks using the command-line interface. 
    39 
    40 === (a) The ping module ===
    41 
    42 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:
    43 
    44 {{{
    45 $ ansible nodes -i ansible-hosts -m ping
    46 }}}
    47 
    48 If you don’t see success everywhere then there is something wrong with your setup.  Ask one of the tutorial leaders for help.  Note that you will be prompted to accept each node as you log into it; this happens only once per node, the first time you log in.
    49 
    50 === (b) The shell module ===
    51 
    52 The '''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:
    53 
    54 {{{
    55 $ ansible nodes -i ansible-hosts -m shell -a "hostname"
    56 }}}
    57 
    58 You can replace ''hostname'' above with any other Linux command.
    59 
    60 === (c) The setup module ===
    61 
    62 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):
    63 
    64 {{{
    65 $ ansible <your-slicelet>.pcvm1-1.instageni.wisc.edu -i ansible-hosts -m setup
    66 }}}
    67 
    68 === (d) A simple playbook ===
    69 
    70 Next, 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:
    71 
    72 {{{
    73 #!python
    74 ---
    75 - hosts: nodes
    76   remote_user: root
    77   tasks:
    78   - name: An example of a debug statement
    79     debug: var=ansible_hostname
    80 }}}
    81 
    82 Run the playbook as:
    83 
    84 {{{
    85 $ ansible-playbook -i ansible-hosts test.yaml
    86 }}}
    87 
    88 The '''setup''' module is run automatically at the beginning of a playbook to populate variables for each node.  The above playbook will dump the value of each node’s ''ansible_hostname'' variable.  To run the playbook on a single node, replace ''nodes'' with the name of one of your slice nodes (e.g., slice338.pcvm3-7.instageni.nps.edu).
    8938
    9039-----
    9140
    92 == 2. Create an Ansible playbook to download a parameterized URL from each node ==
     41== 1. Create an Ansible playbook to download a parameterized URL from each node ==
    9342
    9443Think about how you are going 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.
     
    151100
    152101
    153   ### 2(a): Get the container's FQDN ###
     102  ### (a): Get the container's FQDN ###
    154103  - name: Dump container FQDN
    155104    debug: # INSERT ARGUMENTS HERE
    156105
    157106
    158   ### 2(b):  Get the container IP address ###
     107  ### (b):  Get the container IP address ###
    159108  - name: Dump container IP address
    160109    debug: # INSERT ARGUMENTS HERE
    161110
    162111
    163   ### 2(c): Get the control host name ###
     112  ### (c): Get the control host name ###
    164113  - name: Dump control host name
    165114    debug: # INSERT ARGUMENTS HERE
    166115
    167116
    168   ### 2(d): Get the host's public IP address ###
     117  ### (d): Get the host's public IP address ###
    169118  - name: Install dnsutils (for dig)
    170119    apt: # INSERT ARGUMENTS HERE
     
    178127
    179128
    180   ### 2(e): Get the latitude and longitude for each node ###
     129  ### (e): Get the latitude and longitude for each node ###
    181130  - name: Install geoip-bin (for geoiplookup)
    182131    apt: # INSERT ARGUMENTS HERE
     
    203152
    204153
    205   ### 2(f): Fetch the parameterized URL ###
    206   - name: Dump the full URL
     154  ### (f): Fetch the parameterized URL ###
     155  - name: Dump the full URL, to make sure it looks OK
    207156    debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE"
    208157
     
    216165----
    217166
    218 == 3. Run the playbook ==
     167== 2. Run the playbook ==
    219168
    220169Once you have finished your playbook, run it against all the nodes! 
     
    224173----
    225174
    226 == 4. Verify that your playbook worked as expected ==
     175== 3. Verify that your playbook worked as expected ==
    227176
    228177Once you have completed the tutorial, you can check where you’ve said hello from at: