Changes between Version 23 and Version 24 of GENIExperimenter/Tutorials/GENIExperimentEngine/Execute


Ignore:
Timestamp:
03/16/15 17:35:09 (9 years ago)
Author:
acb@cs.princeton.edu
Comment:

--

Legend:

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

    v23 v24  
    6868=== (a) Create a starter Ansible playbook ===
    6969
    70 A playbook is a YAML file containing a list of Ansible tasks.  To get started creating your Ansible playbook, copy the following into a file called lab.yaml:
     70A playbook is a YAML file containing a list of Ansible tasks.  To get started creating your Ansible playbook, copy the following into a file called test.yaml:
    7171
    7272{{{
     
    8282
    8383{{{
    84 $ ansible-playbook -i ansible-hosts lab.yaml
     84$ ansible-playbook -i ansible-hosts test.yaml
    8585}}}
    8686
     
    9595|| [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' Starting an task in an Ansible playbook with "`- name:`", as in the example above, prints out the string following name at the beginning of the task.  This is useful for keeping track of where you are in a playbook run. ||
    9696
    97 === (b) Get the container name ===
    98 
    99 Look at the variables collected by Ansible's setup module (step 1(c) above).  Find one that holds the container name.  Add a debug task to your playbook, like the one in the starter playbook, to print out its value.  Complete the following task and add it to your playbook.
    100 
    101 {{{
    102    - name: Print container name variable
    103      debug: var=
    104 }}}
     97Here is an Ansible playbook skeleton that you can use to complete the tutorial. 
     98
     99{{{
     100---
     101- hosts: nodes
     102  remote_user: root
     103  tasks:
     104  - name: Update apt cache
     105    shell: apt-get update
     106
     107  - name: Install python-apt (to work around an Ansible bug)
     108    shell: apt-get -y install python-apt
     109
     110  - name: 2(a): Dump container FQDN
     111    debug: # INSERT ARGUMENTS HERE
     112
     113  - name: 2(b): Dump container IP address
     114    debug: # INSERT ARGUMENTS HERE
     115
     116  - name: 2(c): Dump control host name
     117    debug: # INSERT ARGUMENTS HERE
     118
     119  - name: 2(d): Install dnsutils (for dig)
     120    apt: # INSERT ARGUMENTS HERE
     121
     122  - name: 2(d): Get my public IP using 'dig +short'
     123    shell: # INSERT ARGUMENTS HERE
     124    register: public_ip
     125
     126  - name: 2(d): Dump public_ip variable
     127    debug: var=public_ip
     128
     129  - name: 2(e): Install geoip-bin (for geoiplookup)
     130    apt: # INSERT ARGUMENTS HERE
     131
     132  - name: 2(e): Download GeoLiteCity DB
     133    get_url: # INSERT ARGUMENTS HERE
     134
     135  - name: 2(e): Unzip GeoLiteCity.dat.gz
     136    shell: gunzip -f GeoLiteCity.dat.gz
     137
     138  - name: 2(e): Run geoiplookup to get latitude
     139    shell: # INSERT ARGUMENTS HERE
     140    register: lat
     141
     142  - name: 2(e): Dump lat variable
     143    debug: var=lat
     144
     145  - name: 2(e): Run geoiplookup to get longitude
     146    shell: # INSERT ARGUMENTS HERE
     147    register: long
     148
     149  - name: 2(e): Dump long variable
     150    debug: var=long
     151
     152  - name: Dump the full URL
     153  - debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE"
     154
     155  - shell: curl "http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE"
     156}}}
     157
     158
     159
     160=== (b) Get the container's FQDN ===
     161
     162Look at the variables collected by Ansible's setup module (step 1(c) above).  Find one that holds the container's fully-qualified domain name (e.g., slice347.pcvm1-1.instageni.iu.edu). 
    105163
    106164=== (c) Get the container IP address ===