Changes between Version 7 and Version 8 of GENIExperimenter/Tutorials/GENI-SAVI/Execute


Ignore:
Timestamp:
06/16/15 09:38:38 (9 years ago)
Author:
Vic Thomas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/GENI-SAVI/Execute

    v7 v8  
    3737the variables you'll need.  You then need to fetch a custom URL containing this information from each host.   
    3838
    39 Below is the [attachment:gee-tutorial.yaml skeleton Ansible playbook] that you will need.  To download this playbook to your client machine:
     39Below is the [attachment:gee-tutorial.yaml Ansible playbook] that you will need.  To download this playbook to your client machine:
    4040{{{
    4141 wget http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/GENI-SAVI/Execute/gee-tutorial-solution.yaml
    4242}}}
    4343
    44 
     44The ansible playbook:
    4545{{{
    4646---
    4747- hosts: nodes
    48   remote_user: root
     48  remote_user: "{{ ansible_ssh_user }}"
     49  sudo: yes
    4950  tasks:
    5051
    51  
    52 
    53   ### (a): Get the control host name ###
    54   - name: Dump control host name
    55     debug: # INSERT ARGUMENTS HERE
     52  ### (a): Get the container's FQDN ###
     53  - name: Dump container name
     54    debug: var=ansible_fqdn
    5655
    5756
    58   ### (b): Get the host's public IP address ###
    59   - name: Get my public IP using 'dig +short'
    60     shell: # INSERT ARGUMENTS HERE
     57  ### (b):  Get the container IP address ###
     58  - name: Dump container IP address
     59    debug: var=ansible_eth0.ipv4.address
     60
     61
     62  ### (c): Get the control host name ###
     63  - name: Dump control host name
     64    debug: var=ansible_ssh_host
     65
     66
     67  ### (d): Get the host's public IP address ###
     68  - name: Get my public IP
     69    shell: dig +short {{ ansible_ssh_host }}
    6170    register: public_ip
    6271
     
    6574
    6675
    67   ### (c): Get the latitude and longitude for each node ###
     76  ### (e): Get the latitude and longitude for each node ###
    6877  - name: Download GeoLiteCity DB
    69     get_url: # INSERT ARGUMENTS HERE
     78    get_url: url=http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
     79      dest=/tmp
    7080
    7181  - name: Unzip GeoLiteCity.dat.gz
    72     shell: gunzip -f GeoLiteCity.dat.gz
     82    shell: gunzip -f /tmp/GeoLiteCity.dat.gz
     83      creates=GeoLiteCity.dat
    7384
    7485  - name: Run geoiplookup to get latitude
    75     shell: # INSERT ARGUMENTS HERE
    76     register: latitude
     86    shell: geoiplookup -f /tmp/GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $7}'
     87    register: lat
    7788
    78   - name: Dump latitude variable
    79     debug: var=latitude
     89  - name: Dump lat variable
     90    debug: var=lat
    8091
    8192  - name: Run geoiplookup to get longitude
    82     shell: # INSERT ARGUMENTS HERE
    83     register: longitude
     93    shell: geoiplookup -f /tmp/GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $8}'
     94    register: long
    8495
    85   - name: Dump longitude variable
    86     debug: var=longitude
     96  - name: Dump long variable
     97    debug: var=long
    8798
    8899
    89   ### (d): Fetch the parameterized URL ###
    90   - name: Dump the full URL, to make sure it looks OK
    91     debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE"
     100  ### (f): Fetch the parameterized URL ###
     101  - debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice={{ ansible_hostname }}&name={{ ansible_fqdn }}&ip={{ public_ip.stdout }}&local={{ ansible_eth0.ipv4.address }}&lat={{ lat.stdout }}&lng={{ long.stdout }}"
    92102
    93   - name: Fetch the full URL
    94     shell: curl "http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE"
     103  - shell: curl "http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice={{ ansible_hostname }}&name={{ ansible_fqdn }}&ip={{ public_ip.stdout }}&local={{ ansible_eth0.ipv4.address }}&lat={{ lat.stdout }}&lng={{ long.stdout }}"
    95104}}}
    96105