Changes between Version 41 and Version 42 of GENIExperimenter/Tutorials/GENIExperimentEngine/Execute
- Timestamp:
- 03/18/15 17:56:28 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GENIExperimenter/Tutorials/GENIExperimentEngine/Execute
v41 v42 30 30 '''This page will log each of your queries, and you can check that all your nodes were successfully able to run the query.''' 31 31 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. 32 You will use Ansible to do this. 33 34 == 1. Create an Ansible playbook to install the software you'll need == 35 36 First 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]. 36 37 37 38 {{{ … … 42 43 tasks: 43 44 - 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 54 Run 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 60 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. 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 61 the variables you'll need. You then need to fetch a custom URL containing this information from each host. 62 63 Below 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: 49 71 50 72 ### (a): Get the container's FQDN ### … … 64 86 65 87 ### (d): Get the host's public IP address ### 66 - name: Install dnsutils (for dig)67 apt: # INSERT ARGUMENTS HERE68 69 88 - name: Get my public IP using 'dig +short' 70 89 shell: # INSERT ARGUMENTS HERE … … 76 95 77 96 ### (e): Get the latitude and longitude for each node ### 78 - name: Install geoip-bin (for geoiplookup)79 apt: # INSERT ARGUMENTS HERE80 81 97 - name: Download GeoLiteCity DB 82 98 get_url: # INSERT ARGUMENTS HERE … … 101 117 102 118 ### (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 104 120 debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE" 105 121 … … 108 124 }}} 109 125 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. 126 The following subsections provide further guidance on how to complete each step. 116 127 117 128 === (a) Get the container's FQDN === 118 129 119 Look at the variables collected by Ansible's setupmodule. 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.130 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. 120 131 121 132 === (b) Get the container IP address === 122 133 123 Look at the variables collected by Ansible's setupmodule. Find one that holds the container IP address and dump it using a '''debug''' task.134 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. 124 135 125 136 === (c) Get the control host name === 126 137 127 Look at the variables collected by Ansible's setupmodule. 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.138 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. 128 139 129 140 === (d) Get the host's public IP address === … … 171 182 ---- 172 183 173 == 2. Run the playbook ==184 == 3. Run the playbook == 174 185 175 186 Once you have finished your playbook, run it against all the nodes! 176 187 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 == 183 191 184 192 Once you have completed the tutorial, you can check where you’ve said hello from at: